mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
chore: merge, lint, stan
This commit is contained in:
@@ -313,7 +313,7 @@ class Exception extends \Exception
|
||||
$this->code = $code ?? $this->errors[$type]['code'];
|
||||
|
||||
// Mark string errors like HY001 from PDO as 500 errors
|
||||
if(\is_string($this->code)) {
|
||||
if (\is_string($this->code)) {
|
||||
if (\is_numeric($this->code)) {
|
||||
$this->code = (int) $this->code;
|
||||
} else {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Appwrite\Functions\Validator;
|
||||
|
||||
use Utopia\Validator;
|
||||
use Utopia\Http\Validator;
|
||||
|
||||
/**
|
||||
* Headers.
|
||||
@@ -44,7 +44,7 @@ class Headers extends Validator
|
||||
return false;
|
||||
}
|
||||
|
||||
if(\count($value) > $this->maxKeys) {
|
||||
if (\count($value) > $this->maxKeys) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ class Headers extends Validator
|
||||
}
|
||||
|
||||
$size += $length + \strlen($val);
|
||||
if($size >= $this->maxSize) {
|
||||
if ($size >= $this->maxSize) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Appwrite\Functions\Validator;
|
||||
|
||||
use Utopia\Validator\Text;
|
||||
use Utopia\Http\Validator\Text;
|
||||
|
||||
class Payload extends Text
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Appwrite\Functions\Validator;
|
||||
|
||||
use Utopia\Validator;
|
||||
use Utopia\Http\Validator;
|
||||
|
||||
class RuntimeSpecification extends Validator
|
||||
{
|
||||
|
||||
@@ -211,7 +211,7 @@ class Builds extends Action
|
||||
}
|
||||
|
||||
try {
|
||||
if($isNewBuild && !$isVcsEnabled) {
|
||||
if ($isNewBuild && !$isVcsEnabled) {
|
||||
// Non-vcs+Template
|
||||
|
||||
$templateRepositoryName = $template->getAttribute('repositoryName', '');
|
||||
@@ -231,7 +231,7 @@ class Builds extends Action
|
||||
$exit = Console::execute($gitCloneCommandForTemplate, '', $output);
|
||||
|
||||
if ($exit !== 0) {
|
||||
throw new \Exception('Unable to clone code repository: ' . $stderr);
|
||||
throw new \Exception('Unable to clone code repository: ' . $output);
|
||||
}
|
||||
|
||||
// Ensure directories
|
||||
@@ -281,7 +281,7 @@ class Builds extends Action
|
||||
|
||||
$cloneVersion = $branchName;
|
||||
$cloneType = GitHub::CLONE_TYPE_BRANCH;
|
||||
if(!empty($commitHash)) {
|
||||
if (!empty($commitHash)) {
|
||||
$cloneVersion = $commitHash;
|
||||
$cloneType = GitHub::CLONE_TYPE_COMMIT;
|
||||
}
|
||||
@@ -307,7 +307,7 @@ class Builds extends Action
|
||||
$exit = Console::execute('mv "' . \escapeshellarg($from) . '" "' . \escapeshellarg($to) . '"', '', $output);
|
||||
|
||||
if ($exit !== 0) {
|
||||
throw new \Exception('Unable to move function with spaces' . $stderr);
|
||||
throw new \Exception('Unable to move function with spaces' . $output);
|
||||
}
|
||||
$rootDirectory = $rootDirectoryWithoutSpaces;
|
||||
}
|
||||
@@ -541,7 +541,7 @@ class Builds extends Action
|
||||
deploymentId: $deployment->getId(),
|
||||
projectId: $project->getId(),
|
||||
callback: function ($logs) use (&$response, &$err, &$build, $dbForProject, $allEvents, $project, &$isCanceled) {
|
||||
if($isCanceled) {
|
||||
if ($isCanceled) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -669,7 +669,7 @@ class Messaging extends Action
|
||||
|
||||
private function getLocalDevice($project): Local
|
||||
{
|
||||
if($this->localDevice === null) {
|
||||
if ($this->localDevice === null) {
|
||||
$this->localDevice = new Local(APP_STORAGE_UPLOADS . '/app-' . $project->getId());
|
||||
}
|
||||
|
||||
|
||||
@@ -240,7 +240,7 @@ class OpenAPI3 extends Format
|
||||
if ($route->getLabel('sdk.response.code', 500) === 204) {
|
||||
$labelCode = (string)$route->getLabel('sdk.response.code', '500');
|
||||
$temp['responses'][$labelCode]['description'] = 'No content';
|
||||
if(isset($temp['responses'][$labelCode]['schema'])) {
|
||||
if (isset($temp['responses'][$labelCode]['schema'])) {
|
||||
unset($temp['responses'][$labelCode]['schema']);
|
||||
}
|
||||
}
|
||||
@@ -274,7 +274,7 @@ class OpenAPI3 extends Format
|
||||
foreach ($route->getParams() as $name => $param) { // Set params
|
||||
$injections = [];
|
||||
|
||||
if(isset($param['injections'])) {
|
||||
if (isset($param['injections'])) {
|
||||
$injections = array_map(fn ($injection) => $this->http->getContainer()->get($injection), $param['injections']);
|
||||
}
|
||||
|
||||
|
||||
@@ -272,7 +272,7 @@ class Swagger2 extends Format
|
||||
foreach ($parameters as $name => $param) { // Set params
|
||||
$injections = [];
|
||||
|
||||
if(isset($param['injections'])) {
|
||||
if (isset($param['injections'])) {
|
||||
$injections = array_map(fn ($injection) => $this->http->getContainer()->get($injection), $param['injections']);
|
||||
}
|
||||
|
||||
@@ -293,13 +293,13 @@ class Swagger2 extends Format
|
||||
}
|
||||
|
||||
$validatorClass = (!empty($validator)) ? \get_class($validator) : '';
|
||||
if($validatorClass === 'Utopia\Validator\AnyOf') {
|
||||
if ($validatorClass === 'Utopia\Http\Validator\AnyOf') {
|
||||
$validator = $param['validator']->getValidators()[0];
|
||||
$validatorClass = \get_class($validator);
|
||||
}
|
||||
|
||||
switch ($validatorClass) {
|
||||
case 'Utopia\Validator\Text':
|
||||
case 'Utopia\Http\Validator\Text':
|
||||
case 'Utopia\Database\Validator\UID':
|
||||
$node['type'] = $validator->getType();
|
||||
$node['x-example'] = '<' . \strtoupper(Template::fromCamelCaseToSnake($node['name'])) . '>';
|
||||
|
||||
@@ -134,7 +134,7 @@ class Request extends HttpRequest
|
||||
*/
|
||||
public function getHeaders(): array
|
||||
{
|
||||
if($this->headers !== null) {
|
||||
if ($this->headers !== null) {
|
||||
return $this->headers;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ use Exception;
|
||||
use JsonException;
|
||||
// Keep last
|
||||
use Utopia\Database\Document;
|
||||
use Utopia\Swoole\Response as SwooleResponse;
|
||||
use Utopia\Http\Adapter\Swoole\Response as HttpResponse;
|
||||
|
||||
// Keep last
|
||||
|
||||
@@ -16,7 +16,7 @@ use Utopia\Swoole\Response as SwooleResponse;
|
||||
* @method int getStatusCode()
|
||||
* @method Response setStatusCode(int $code = 200)
|
||||
*/
|
||||
class Response extends SwooleResponse
|
||||
class Response extends HttpResponse
|
||||
{
|
||||
// General
|
||||
public const MODEL_NONE = 'none';
|
||||
|
||||
@@ -33,13 +33,13 @@ class V16 extends Filter
|
||||
|
||||
protected function parseDeployment(array $content)
|
||||
{
|
||||
if(isset($content['buildLogs'])) {
|
||||
if (isset($content['buildLogs'])) {
|
||||
$content['buildStderr'] = '';
|
||||
$content['buildStdout'] = $content['buildLogs'];
|
||||
unset($content['buildLogs']);
|
||||
}
|
||||
|
||||
if(isset($content['buildSize'])) {
|
||||
if (isset($content['buildSize'])) {
|
||||
$content['size'] += + $content['buildSize'] ?? 0;
|
||||
unset($content['buildSize']);
|
||||
}
|
||||
|
||||
@@ -25,8 +25,8 @@ class V18 extends Filter
|
||||
|
||||
protected function parseExecution(array $content)
|
||||
{
|
||||
if(!empty($content['status']) && !empty($content['statusCode'])) {
|
||||
if($content['status'] === 'completed' && $content['statusCode'] >= 400 && $content['statusCode'] < 500) {
|
||||
if (!empty($content['status']) && !empty($content['statusCode'])) {
|
||||
if ($content['status'] === 'completed' && $content['statusCode'] >= 400 && $content['statusCode'] < 500) {
|
||||
$content['status'] = 'failed';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Appwrite\Utopia\Response;
|
||||
|
||||
use Appwrite\Utopia\Response;
|
||||
use Appwrite\Utopia\Response\Model\Account;
|
||||
use Appwrite\Utopia\Response\Model\AlgoArgon2;
|
||||
use Appwrite\Utopia\Response\Model\AlgoBcrypt;
|
||||
|
||||
@@ -217,7 +217,7 @@ class Executor
|
||||
'restartPolicy' => 'always' // Once utopia/orchestration has it, use DockerAPI::ALWAYS (0.13+)
|
||||
];
|
||||
|
||||
if(!empty($body)) {
|
||||
if (!empty($body)) {
|
||||
$params['body'] = $body;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user