@@ -133,8 +133,7 @@ discard block |
||
| 133 | 133 | // attrs validation |
| 134 | 134 | $this->startArray(); |
| 135 | 135 | if (empty($relationTypes) === false) { |
| 136 | - $rel = empty($relationTypes[ApiInterface::RAML_TYPE]) ? $relationTypes : |
|
| 137 | - $relationTypes[ApiInterface::RAML_TYPE]; |
|
| 136 | + $rel = empty($relationTypes[ApiInterface::RAML_TYPE]) ? $relationTypes : $relationTypes[ApiInterface::RAML_TYPE]; |
|
| 138 | 137 | |
| 139 | 138 | $rels = explode(PhpInterface::PIPE, str_replace('[]', '', $rel)); |
| 140 | 139 | foreach ($rels as $k => $rel) { |
@@ -230,7 +229,7 @@ discard block |
||
| 230 | 229 | [JSONApiInterface::PARAM_ACCESS_TOKEN][ApiInterface::RAML_KEY_DEFAULT]) === false |
| 231 | 230 | ) { |
| 232 | 231 | $this->setAccessTokenContent(); |
| 233 | - $fileForm = FileManager::getModulePath($this->generator, true) . $this->generator->formRequestDir |
|
| 232 | + $fileForm = FileManager::getModulePath($this->generator, true) . $this->generator->formRequestDir |
|
| 234 | 233 | . PhpInterface::SLASH . JSONApiInterface::CLASS_API_ACCESS_TOKEN |
| 235 | 234 | . PhpInterface::PHP_EXT; |
| 236 | 235 | |
@@ -264,7 +264,7 @@ |
||
| 264 | 264 | public function createAccessToken() |
| 265 | 265 | { |
| 266 | 266 | if (empty($this->generator->types[CustomsInterface::CUSTOM_TYPES_QUERY_PARAMS][ApiInterface::RAML_PROPS] |
| 267 | - [JSONApiInterface::PARAM_ACCESS_TOKEN][ApiInterface::RAML_KEY_DEFAULT]) === false |
|
| 267 | + [JSONApiInterface::PARAM_ACCESS_TOKEN][ApiInterface::RAML_KEY_DEFAULT]) === false |
|
| 268 | 268 | ) { |
| 269 | 269 | $this->setAccessTokenContent(); |
| 270 | 270 | $fileForm = FileManager::getModulePath($this->generator, true) . $this->generator->formRequestDir |
@@ -104,9 +104,9 @@ discard block |
||
| 104 | 104 | public static function migrationNotExists(Command $obj, string $migrationName): bool |
| 105 | 105 | { |
| 106 | 106 | $path = FileManager::getModulePath($obj) . self::DATABASE_DIR . PhpInterface::SLASH |
| 107 | - . $obj->migrationsDir . PhpInterface::SLASH; |
|
| 107 | + . $obj->migrationsDir . PhpInterface::SLASH; |
|
| 108 | 108 | $file = $path . PhpInterface::ASTERISK . $migrationName |
| 109 | - . PhpInterface::PHP_EXT; |
|
| 109 | + . PhpInterface::PHP_EXT; |
|
| 110 | 110 | $files = glob($file); |
| 111 | 111 | |
| 112 | 112 | return empty($files) ? true : false; |
@@ -123,8 +123,8 @@ discard block |
||
| 123 | 123 | public static function getPivotFile(string $firstEntity, string $secondEntity): string |
| 124 | 124 | { |
| 125 | 125 | return DirsInterface::MODULES_DIR . PhpInterface::SLASH |
| 126 | - . ConfigHelper::getModuleName() . PhpInterface::SLASH . |
|
| 127 | - DirsInterface::ENTITIES_DIR . PhpInterface::SLASH . |
|
| 128 | - $firstEntity . $secondEntity . PhpInterface::PHP_EXT; |
|
| 126 | + . ConfigHelper::getModuleName() . PhpInterface::SLASH . |
|
| 127 | + DirsInterface::ENTITIES_DIR . PhpInterface::SLASH . |
|
| 128 | + $firstEntity . $secondEntity . PhpInterface::PHP_EXT; |
|
| 129 | 129 | } |
| 130 | 130 | } |
| 131 | 131 | \ No newline at end of file |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | public static function createFile($fileName, $content, $isNew = false): bool |
| 28 | 28 | { |
| 29 | - if($isNew === true || file_exists($fileName) === false) |
|
| 29 | + if ($isNew === true || file_exists($fileName) === false) |
|
| 30 | 30 | { |
| 31 | 31 | $fp = fopen($fileName, self::FILE_MODE_CREATE); |
| 32 | 32 | fwrite($fp, $content); |
@@ -44,9 +44,9 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | public static function createPath($path) |
| 46 | 46 | { |
| 47 | - if(is_dir($path) === false) |
|
| 47 | + if (is_dir($path) === false) |
|
| 48 | 48 | { |
| 49 | - if(mkdir($path, self::DIR_MODE, true) === false) |
|
| 49 | + if (mkdir($path, self::DIR_MODE, true) === false) |
|
| 50 | 50 | { |
| 51 | 51 | throw new DirectoryException( |
| 52 | 52 | 'Couldn`t create directory ' |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | /** @var ApiGenerator $obj */ |
| 74 | 74 | $path = $obj->modulesDir . PhpInterface::SLASH . strtoupper($obj->version) . PhpInterface::SLASH; |
| 75 | 75 | |
| 76 | - if($http === true) |
|
| 76 | + if ($http === true) |
|
| 77 | 77 | { |
| 78 | 78 | $path .= $obj->httpDir . PhpInterface::SLASH; |
| 79 | 79 | } |
@@ -103,7 +103,7 @@ |
||
| 103 | 103 | private function openCache(string $entity): void |
| 104 | 104 | { |
| 105 | 105 | $this->openEntity(strtolower($entity), 2); |
| 106 | - $this->setParam(ConfigInterface::ENABLED, ApiInterface::RAML_TYPE_BOOLEAN,PhpInterface::PHP_TYPES_BOOL_TRUE, 3); |
|
| 106 | + $this->setParam(ConfigInterface::ENABLED, ApiInterface::RAML_TYPE_BOOLEAN, PhpInterface::PHP_TYPES_BOOL_TRUE, 3); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /** |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | $this->isEnabled = empty($this->entity[$this->field][ConfigInterface::ENABLED]) ? false : true; |
| 26 | 26 | $this->language = empty($this->entity[$this->field][ConfigInterface::LANGUAGE]) ? ConfigInterface::DEFAULT_LANGUAGE |
| 27 | 27 | : $this->entity[$this->field][ConfigInterface::LANGUAGE]; |
| 28 | - if($this->isEnabled === true) { |
|
| 28 | + if ($this->isEnabled === true) { |
|
| 29 | 29 | $this->speLink = pspell_new($this->language, '', '', '', PSPELL_FAST); |
| 30 | 30 | } |
| 31 | 31 | } |
@@ -41,9 +41,9 @@ discard block |
||
| 41 | 41 | $failed = []; |
| 42 | 42 | $cleanText = $this->cleanText($text); |
| 43 | 43 | $words = explode(PhpInterface::SPACE, $cleanText); |
| 44 | - foreach($words as $k => $word) { |
|
| 44 | + foreach ($words as $k => $word) { |
|
| 45 | 45 | $pass = pspell_check($this->speLink, $word); |
| 46 | - if($pass === false) { |
|
| 46 | + if ($pass === false) { |
|
| 47 | 47 | $failed[] = $word; |
| 48 | 48 | } |
| 49 | 49 | } |
@@ -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]; |