@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public function setStates(string $field) : void |
| 68 | 68 | { |
| 69 | - if(empty($this->machine[$field][ConfigInterface::STATES])) { |
|
| 69 | + if (empty($this->machine[$field][ConfigInterface::STATES])) { |
|
| 70 | 70 | throw new AttributesException(ErrorsInterface::JSON_API_ERRORS[ErrorsInterface::HTTP_CODE_BULK_EXT_ERROR], ErrorsInterface::HTTP_CODE_BULK_EXT_ERROR); |
| 71 | 71 | } |
| 72 | 72 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public function setInitial(string $field) : void |
| 81 | 81 | { |
| 82 | - if(empty($this->machine[$field][ConfigInterface::STATES][ConfigInterface::INITIAL][0])) { |
|
| 82 | + if (empty($this->machine[$field][ConfigInterface::STATES][ConfigInterface::INITIAL][0])) { |
|
| 83 | 83 | throw new AttributesException('There should be an initial value for: "' . $field . '" field."', ErrorsInterface::HTTP_CODE_FSM_INIT_ATTR); |
| 84 | 84 | } |
| 85 | 85 | |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | protected function createJwtUser() |
| 21 | 21 | { |
| 22 | - if(empty($this->model->password)) { |
|
| 22 | + if (empty($this->model->password)) { |
|
| 23 | 23 | Json::outputErrors( |
| 24 | 24 | [ |
| 25 | 25 | [ |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | private function updateJwtUser(&$model, $jsonApiAttributes) |
| 48 | 48 | { |
| 49 | - if(password_verify($jsonApiAttributes[JwtInterface::PASSWORD], $model->password) === false) { |
|
| 49 | + if (password_verify($jsonApiAttributes[JwtInterface::PASSWORD], $model->password) === false) { |
|
| 50 | 50 | Json::outputErrors( |
| 51 | 51 | [ |
| 52 | 52 | [ |
@@ -29,12 +29,12 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | public function handle($request, Closure $next) |
| 31 | 31 | { |
| 32 | - if(ConfigHelper::getNestedParam(ConfigInterface::JWT, ConfigInterface::ENABLED) === true) { |
|
| 33 | - if(empty($request->jwt)) { |
|
| 32 | + if (ConfigHelper::getNestedParam(ConfigInterface::JWT, ConfigInterface::ENABLED) === true) { |
|
| 33 | + if (empty($request->jwt)) { |
|
| 34 | 34 | die('JWT token required.'); |
| 35 | 35 | } |
| 36 | 36 | $token = (new Parser())->parse((string)$request->jwt); |
| 37 | - if(Jwt::verify($token, $token->getHeader('jti')) === false) { |
|
| 37 | + if (Jwt::verify($token, $token->getHeader('jti')) === false) { |
|
| 38 | 38 | header('HTTP/1.1 403 Forbidden'); |
| 39 | 39 | die('Access forbidden.'); |
| 40 | 40 | } |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | class CustomSql |
| 13 | 13 | { |
| 14 | - private $entity = []; |
|
| 14 | + private $entity = []; |
|
| 15 | 15 | private $isEnabled; |
| 16 | 16 | |
| 17 | 17 | /** |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | class BitMask |
| 13 | 13 | { |
| 14 | - private $entity = []; |
|
| 14 | + private $entity = []; |
|
| 15 | 15 | private $field; |
| 16 | 16 | private $isEnabled; |
| 17 | 17 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public function getFlags() |
| 50 | 50 | { |
| 51 | - if(empty($this->entity[$this->field][ConfigInterface::FLAGS])) { |
|
| 51 | + if (empty($this->entity[$this->field][ConfigInterface::FLAGS])) { |
|
| 52 | 52 | throw new AttributesException(ErrorsInterface::JSON_API_ERRORS[ErrorsInterface::HTTP_CODE_FSM_FLAGS], ErrorsInterface::HTTP_CODE_FSM_FLAGS); |
| 53 | 53 | } |
| 54 | 54 | return $this->entity[$this->field][ConfigInterface::FLAGS]; |
@@ -351,10 +351,10 @@ |
||
| 351 | 351 | $this->historyTypes = $dataHistory[ApiInterface::API_COMPONENTS][ApiInterface::API_SCHEMAS]; |
| 352 | 352 | $this->types += array_merge_recursive($this->historyTypes, $this->currentTypes); |
| 353 | 353 | |
| 354 | - $attrsCurrent += array_filter($this->currentTypes, function ($k) { |
|
| 354 | + $attrsCurrent += array_filter($this->currentTypes, function($k) { |
|
| 355 | 355 | return strpos($k, CustomsInterface::CUSTOM_TYPES_ATTRIBUTES) !== false; |
| 356 | 356 | }, ARRAY_FILTER_USE_KEY); |
| 357 | - $attrsHistory += array_filter($this->historyTypes, function ($k) { |
|
| 357 | + $attrsHistory += array_filter($this->historyTypes, function($k) { |
|
| 358 | 358 | return strpos($k, CustomsInterface::CUSTOM_TYPES_ATTRIBUTES) !== false; |
| 359 | 359 | }, ARRAY_FILTER_USE_KEY); |
| 360 | 360 | } |
@@ -83,13 +83,11 @@ discard block |
||
| 83 | 83 | // get params |
| 84 | 84 | $params = $this->getMethodParams($methodOptions->getParams()); |
| 85 | 85 | $this->sourceCode .= PhpInterface::TAB_PSR4 . $methodOptions->getModifier() . PhpInterface::SPACE . |
| 86 | - (($methodOptions->isStatic() !== false) ? PhpInterface::PHP_STATIC . PhpInterface::SPACE : |
|
| 87 | - '') . |
|
| 86 | + (($methodOptions->isStatic() !== false) ? PhpInterface::PHP_STATIC . PhpInterface::SPACE : '') . |
|
| 88 | 87 | PhpInterface::PHP_FUNCTION . PhpInterface::SPACE . |
| 89 | 88 | $methodOptions->getName() |
| 90 | 89 | . PhpInterface::OPEN_PARENTHESES . $params . PhpInterface::CLOSE_PARENTHESES . |
| 91 | - ((empty($methodOptions->getReturnType())) ? '' : |
|
| 92 | - PhpInterface::COLON . PhpInterface::SPACE . $methodOptions->getReturnType()) . |
|
| 90 | + ((empty($methodOptions->getReturnType())) ? '' : PhpInterface::COLON . PhpInterface::SPACE . $methodOptions->getReturnType()) . |
|
| 93 | 91 | PhpInterface::SPACE . PHP_EOL . PhpInterface::TAB_PSR4 |
| 94 | 92 | . PhpInterface::OPEN_BRACE . PHP_EOL; |
| 95 | 93 | } |
@@ -103,8 +101,7 @@ discard block |
||
| 103 | 101 | protected function setMethodReturn(string $value, $isString = false): void |
| 104 | 102 | { |
| 105 | 103 | $this->setTabs(2); |
| 106 | - $this->sourceCode .= PhpInterface::PHP_RETURN . PhpInterface::SPACE . (($isString === false) ? $value : |
|
| 107 | - PhpInterface::DOUBLE_QUOTES . $value . PhpInterface::DOUBLE_QUOTES) . PhpInterface::SEMICOLON . PHP_EOL; |
|
| 104 | + $this->sourceCode .= PhpInterface::PHP_RETURN . PhpInterface::SPACE . (($isString === false) ? $value : PhpInterface::DOUBLE_QUOTES . $value . PhpInterface::DOUBLE_QUOTES) . PhpInterface::SEMICOLON . PHP_EOL; |
|
| 108 | 105 | } |
| 109 | 106 | |
| 110 | 107 | /** |
@@ -44,8 +44,8 @@ discard block |
||
| 44 | 44 | public function create() |
| 45 | 45 | { |
| 46 | 46 | $migrationName = ModelsInterface::MIGRATION_CREATE . PhpInterface::UNDERSCORE . |
| 47 | - $this->tableName . |
|
| 48 | - PhpInterface::UNDERSCORE . ModelsInterface::MIGRATION_TABLE; |
|
| 47 | + $this->tableName . |
|
| 48 | + PhpInterface::UNDERSCORE . ModelsInterface::MIGRATION_TABLE; |
|
| 49 | 49 | $attrKey = $this->generator->objectName . CustomsInterface::CUSTOM_TYPES_ATTRIBUTES; |
| 50 | 50 | |
| 51 | 51 | $isFileNonExistent = FileManager::migrationNotExists($this->generator, $migrationName); |
@@ -82,20 +82,20 @@ discard block |
||
| 82 | 82 | foreach($relations as $relationEntity) |
| 83 | 83 | { |
| 84 | 84 | $entityFile = $this->generator->formatEntitiesPath() |
| 85 | - . PhpInterface::SLASH . |
|
| 86 | - $this->generator->objectName . |
|
| 87 | - ucfirst($relationEntity) . |
|
| 88 | - PhpInterface::PHP_EXT; |
|
| 85 | + . PhpInterface::SLASH . |
|
| 86 | + $this->generator->objectName . |
|
| 87 | + ucfirst($relationEntity) . |
|
| 88 | + PhpInterface::PHP_EXT; |
|
| 89 | 89 | if(file_exists($entityFile)) |
| 90 | 90 | { |
| 91 | 91 | $this->setPivotContent($relationEntity); |
| 92 | 92 | |
| 93 | 93 | $migrationMask = date(self::PATTERN_TIME) . (self::$counter + 1); |
| 94 | 94 | $migrationName = ModelsInterface::MIGRATION_CREATE . PhpInterface::UNDERSCORE |
| 95 | - . $this->tableName |
|
| 96 | - . PhpInterface::UNDERSCORE . |
|
| 97 | - MigrationsHelper::getTableName($relationEntity) . |
|
| 98 | - PhpInterface::UNDERSCORE . ModelsInterface::MIGRATION_TABLE; |
|
| 95 | + . $this->tableName |
|
| 96 | + . PhpInterface::UNDERSCORE . |
|
| 97 | + MigrationsHelper::getTableName($relationEntity) . |
|
| 98 | + PhpInterface::UNDERSCORE . ModelsInterface::MIGRATION_TABLE; |
|
| 99 | 99 | |
| 100 | 100 | if(FileManager::migrationNotExists($this->generator, $migrationName)) |
| 101 | 101 | { |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $isFileNonExistent = FileManager::migrationNotExists($this->generator, $migrationName); |
| 52 | 52 | $isAdding = ($this->generator->isMerge === true && empty($this->generator->diffTypes[$attrKey]) === false); |
| 53 | 53 | |
| 54 | - if($isFileNonExistent === true) |
|
| 54 | + if ($isFileNonExistent === true) |
|
| 55 | 55 | { |
| 56 | 56 | $this->setContent(); |
| 57 | 57 | } else if ($isAdding === true) { |
@@ -76,17 +76,17 @@ discard block |
||
| 76 | 76 | $formRequestEntity = $this->getFormRequestEntity($this->generator->version, $this->className); |
| 77 | 77 | /** @var BaseFormRequest $formRequest **/ |
| 78 | 78 | $formRequest = new $formRequestEntity(); |
| 79 | - if(method_exists($formRequest, ModelsInterface::MODEL_METHOD_RELATIONS)) |
|
| 79 | + if (method_exists($formRequest, ModelsInterface::MODEL_METHOD_RELATIONS)) |
|
| 80 | 80 | { |
| 81 | 81 | $relations = $formRequest->relations(); |
| 82 | - foreach($relations as $relationEntity) |
|
| 82 | + foreach ($relations as $relationEntity) |
|
| 83 | 83 | { |
| 84 | 84 | $entityFile = $this->generator->formatEntitiesPath() |
| 85 | 85 | . PhpInterface::SLASH . |
| 86 | 86 | $this->generator->objectName . |
| 87 | 87 | ucfirst($relationEntity) . |
| 88 | 88 | PhpInterface::PHP_EXT; |
| 89 | - if(file_exists($entityFile)) |
|
| 89 | + if (file_exists($entityFile)) |
|
| 90 | 90 | { |
| 91 | 91 | $this->setPivotContent($relationEntity); |
| 92 | 92 | |
@@ -97,13 +97,13 @@ discard block |
||
| 97 | 97 | MigrationsHelper::getTableName($relationEntity) . |
| 98 | 98 | PhpInterface::UNDERSCORE . ModelsInterface::MIGRATION_TABLE; |
| 99 | 99 | |
| 100 | - if(FileManager::migrationNotExists($this->generator, $migrationName)) |
|
| 100 | + if (FileManager::migrationNotExists($this->generator, $migrationName)) |
|
| 101 | 101 | { |
| 102 | 102 | $file = $this->generator->formatMigrationsPath() . $migrationMask |
| 103 | 103 | . PhpInterface::UNDERSCORE . $migrationName . PhpInterface::PHP_EXT; |
| 104 | 104 | // if migration file with the same name ocasionally exists we do not override it |
| 105 | 105 | $isCreated = FileManager::createFile($file, $this->sourceCode); |
| 106 | - if($isCreated) |
|
| 106 | + if ($isCreated) |
|
| 107 | 107 | { |
| 108 | 108 | Console::out($file . PhpInterface::SPACE . Console::CREATED, Console::COLOR_GREEN); |
| 109 | 109 | } |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | */ |
| 26 | 26 | public function openGroup() : void |
| 27 | 27 | { |
| 28 | - $versionNamespace = DirsInterface::MODULES_DIR . |
|
| 28 | + $versionNamespace = DirsInterface::MODULES_DIR . |
|
| 29 | 29 | PhpInterface::BACKSLASH . PhpInterface::BACKSLASH |
| 30 | 30 | . strtoupper($this->generator->version); |
| 31 | 31 | |