mirror of
https://github.com/appwrite/appwrite
synced 2026-05-24 09:28:40 +00:00
AI code quality fixes
This commit is contained in:
parent
d502ab0cd5
commit
52ccbfcdf7
1 changed files with 18 additions and 11 deletions
|
|
@ -32,8 +32,15 @@ class Screenshot extends Action
|
||||||
|
|
||||||
public function action(string $templateId, string $variables): void
|
public function action(string $templateId, string $variables): void
|
||||||
{
|
{
|
||||||
$variables = \json_decode($variables, true);
|
if (empty($variables)) {
|
||||||
if(!\is_array($variables)) {
|
$variables = [];
|
||||||
|
} else {
|
||||||
|
$variables = \json_decode($variables, true);
|
||||||
|
if (!\is_array($variables)) {
|
||||||
|
throw new \Exception('Invalid JSON in --variables flag');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($variables === null) {
|
||||||
throw new \Exception('Invalid JSON in --variables flag');
|
throw new \Exception('Invalid JSON in --variables flag');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -207,7 +214,7 @@ class Screenshot extends Action
|
||||||
$value = \str_replace('{projectId}', $projectId, $value);
|
$value = \str_replace('{projectId}', $projectId, $value);
|
||||||
$value = \str_replace('{apiEndpoint}', 'http://' . System::getEnv('_APP_DOMAIN', '') . '/v1', $value);
|
$value = \str_replace('{apiEndpoint}', 'http://' . System::getEnv('_APP_DOMAIN', '') . '/v1', $value);
|
||||||
|
|
||||||
if(\array_key_exists($name, $variables)) {
|
if (\array_key_exists($name, $variables)) {
|
||||||
$value = $variables[$name];
|
$value = $variables[$name];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue