@@ -42,7 +42,7 @@ |
||
| 42 | 42 | . DefaultInterface::CONTROLLER_POSTFIX |
| 43 | 43 | . PhpInterface::PHP_EXT; |
| 44 | 44 | $isCreated = FileManager::createFile($fileController, $this->sourceCode); |
| 45 | - if($isCreated) |
|
| 45 | + if ($isCreated) |
|
| 46 | 46 | { |
| 47 | 47 | Console::out($fileController . PhpInterface::SPACE . Console::CREATED, Console::COLOR_GREEN); |
| 48 | 48 | } |
@@ -201,7 +201,7 @@ |
||
| 201 | 201 | private function getRelationType(string $objectName) |
| 202 | 202 | { |
| 203 | 203 | if (empty($this->generator->types[$objectName][ApiInterface::RAML_PROPS] |
| 204 | - [ApiInterface::RAML_RELATIONSHIPS][ApiInterface::RAML_TYPE]) === false |
|
| 204 | + [ApiInterface::RAML_RELATIONSHIPS][ApiInterface::RAML_TYPE]) === false |
|
| 205 | 205 | ) { |
| 206 | 206 | return trim( |
| 207 | 207 | $this->generator->types[$objectName][ApiInterface::RAML_PROPS] |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | protected function setEntities() : void |
| 48 | 48 | { |
| 49 | 49 | $this->entity = Classes::cutEntity(Classes::getObjectName($this), DefaultInterface::CONTROLLER_POSTFIX); |
| 50 | - $formRequestEntity = $this->getFormRequestEntity(conf::getModuleName(), $this->entity); |
|
| 50 | + $formRequestEntity = $this->getFormRequestEntity(conf::getModuleName(), $this->entity); |
|
| 51 | 51 | $this->formRequest = new $formRequestEntity(); |
| 52 | 52 | $this->props = get_object_vars($this->formRequest); |
| 53 | 53 | $this->modelEntity = Classes::getModelEntity($this->entity); |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | $this->generator = $generator; |
| 38 | 38 | $this->className = Classes::getClassName($this->generator->objectName); |
| 39 | 39 | $isSoftDelete = empty($this->generator->types[$this->generator->objectName . CustomsInterface::CUSTOM_TYPES_ATTRIBUTES] |
| 40 | - [ApiInterface::RAML_PROPS][ModelsInterface::COLUMN_DEL_AT]) === false; |
|
| 40 | + [ApiInterface::RAML_PROPS][ModelsInterface::COLUMN_DEL_AT]) === false; |
|
| 41 | 41 | $this->setIsSoftDelete($isSoftDelete); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | $formRequest = new $formRequestEntity(); |
| 70 | 70 | if (method_exists($formRequest, ModelsInterface::MODEL_METHOD_RELATIONS)) { |
| 71 | 71 | $this->sourceCode .= PHP_EOL; |
| 72 | - $relations = $formRequest->relations(); |
|
| 72 | + $relations = $formRequest->relations(); |
|
| 73 | 73 | foreach ($relations as $relationEntity) { |
| 74 | 74 | $ucEntitty = ucfirst($relationEntity); |
| 75 | 75 | // determine if ManyToMany, OneToMany, OneToOne rels |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | /** @var BaseFormRequest $formRequest * */ |
| 159 | 159 | $formRequest = new $formRequestEntity(); |
| 160 | 160 | if (method_exists($formRequest, ModelsInterface::MODEL_METHOD_RELATIONS)) { |
| 161 | - $relations = $formRequest->relations(); |
|
| 161 | + $relations = $formRequest->relations(); |
|
| 162 | 162 | $this->sourceCode .= PHP_EOL; // margin top from props |
| 163 | 163 | foreach ($relations as $relationEntity) { |
| 164 | 164 | $ucEntitty = ucfirst($relationEntity); |
@@ -34,19 +34,19 @@ discard block |
||
| 34 | 34 | { |
| 35 | 35 | $attrCnt = |
| 36 | 36 | count($this->generator->types[$this->generator->objectProps[ApiInterface::RAML_ATTRS]][ApiInterface::RAML_PROPS]); |
| 37 | - foreach($this->generator->types[$this->generator->objectProps[ApiInterface::RAML_ATTRS]] |
|
| 37 | + foreach ($this->generator->types[$this->generator->objectProps[ApiInterface::RAML_ATTRS]] |
|
| 38 | 38 | [ApiInterface::RAML_PROPS] as $attrKey => $attrVal) |
| 39 | 39 | { |
| 40 | 40 | --$attrCnt; |
| 41 | 41 | // determine attr |
| 42 | - if(is_array($attrVal)) |
|
| 42 | + if (is_array($attrVal)) |
|
| 43 | 43 | { |
| 44 | 44 | $this->setDescription($attrVal); |
| 45 | 45 | $this->openRule($attrKey); |
| 46 | 46 | $cnt = count($attrVal); |
| 47 | 47 | $this->setFilters($attrVal, $cnt); |
| 48 | 48 | $this->closeRule(); |
| 49 | - if($attrCnt > 0) |
|
| 49 | + if ($attrCnt > 0) |
|
| 50 | 50 | { |
| 51 | 51 | $this->sourceCode .= PHP_EOL; |
| 52 | 52 | } |
@@ -60,10 +60,10 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | private function setFilters(array $attrVal, int $cnt) |
| 62 | 62 | { |
| 63 | - foreach($attrVal as $k => $v) |
|
| 63 | + foreach ($attrVal as $k => $v) |
|
| 64 | 64 | { |
| 65 | 65 | --$cnt; |
| 66 | - if($k === ApiInterface::RAML_KEY_REQUIRED && (bool)$v === false) |
|
| 66 | + if ($k === ApiInterface::RAML_KEY_REQUIRED && (bool)$v === false) |
|
| 67 | 67 | { |
| 68 | 68 | continue; |
| 69 | 69 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | $this->setEnum($k, $v); |
| 73 | 73 | $this->setPattern($k, $v); |
| 74 | 74 | $this->setMinMax($k, $v); |
| 75 | - if($cnt > 0 && in_array($k, $this->excludedKeys) === false) |
|
| 75 | + if ($cnt > 0 && in_array($k, $this->excludedKeys) === false) |
|
| 76 | 76 | { |
| 77 | 77 | $this->sourceCode .= PhpInterface::PIPE; |
| 78 | 78 | } |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | private function setRequired(string $k, $v) |
| 87 | 87 | { |
| 88 | - if($k === ApiInterface::RAML_KEY_REQUIRED && (bool)$v === true) |
|
| 88 | + if ($k === ApiInterface::RAML_KEY_REQUIRED && (bool)$v === true) |
|
| 89 | 89 | { |
| 90 | 90 | $this->sourceCode .= ApiInterface::RAML_KEY_REQUIRED; |
| 91 | 91 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | */ |
| 98 | 98 | private function setPattern(string $k, $v) |
| 99 | 99 | { |
| 100 | - if($k === ApiInterface::RAML_PATTERN) |
|
| 100 | + if ($k === ApiInterface::RAML_PATTERN) |
|
| 101 | 101 | { |
| 102 | 102 | $this->sourceCode .= ModelsInterface::LARAVEL_FILTER_REGEX . PhpInterface::COLON . $v; |
| 103 | 103 | } |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | private function setEnum(string $k, $v) |
| 111 | 111 | { |
| 112 | - if($k === ApiInterface::RAML_ENUM) |
|
| 112 | + if ($k === ApiInterface::RAML_ENUM) |
|
| 113 | 113 | { |
| 114 | 114 | $this->sourceCode .= ModelsInterface::LARAVEL_FILTER_ENUM . PhpInterface::COLON . implode(PhpInterface::COMMA, $v); |
| 115 | 115 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | private function setType(string $k, $v) |
| 123 | 123 | { |
| 124 | - if($k === ApiInterface::RAML_TYPE && in_array($v, $this->legalTypes)) |
|
| 124 | + if ($k === ApiInterface::RAML_TYPE && in_array($v, $this->legalTypes)) |
|
| 125 | 125 | { |
| 126 | 126 | $this->sourceCode .= $v; |
| 127 | 127 | } |
@@ -133,11 +133,11 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | private function setMinMax(string $k, $v) |
| 135 | 135 | { |
| 136 | - if($k === ApiInterface::RAML_STRING_MIN || $k === ApiInterface::RAML_INTEGER_MIN) |
|
| 136 | + if ($k === ApiInterface::RAML_STRING_MIN || $k === ApiInterface::RAML_INTEGER_MIN) |
|
| 137 | 137 | { |
| 138 | 138 | $this->sourceCode .= ModelsInterface::LARAVEL_FILTER_MIN . PhpInterface::COLON . $v; |
| 139 | 139 | } |
| 140 | - else if($k === ApiInterface::RAML_STRING_MAX || $k === ApiInterface::RAML_INTEGER_MAX) |
|
| 140 | + else if ($k === ApiInterface::RAML_STRING_MAX || $k === ApiInterface::RAML_INTEGER_MAX) |
|
| 141 | 141 | { |
| 142 | 142 | $this->sourceCode .= ModelsInterface::LARAVEL_FILTER_MAX . PhpInterface::COLON . $v; |
| 143 | 143 | } |
@@ -136,8 +136,7 @@ |
||
| 136 | 136 | if($k === ApiInterface::RAML_STRING_MIN || $k === ApiInterface::RAML_INTEGER_MIN) |
| 137 | 137 | { |
| 138 | 138 | $this->sourceCode .= ModelsInterface::LARAVEL_FILTER_MIN . PhpInterface::COLON . $v; |
| 139 | - } |
|
| 140 | - else if($k === ApiInterface::RAML_STRING_MAX || $k === ApiInterface::RAML_INTEGER_MAX) |
|
| 139 | + } else if($k === ApiInterface::RAML_STRING_MAX || $k === ApiInterface::RAML_INTEGER_MAX) |
|
| 141 | 140 | { |
| 142 | 141 | $this->sourceCode .= ModelsInterface::LARAVEL_FILTER_MAX . PhpInterface::COLON . $v; |
| 143 | 142 | } |
@@ -79,10 +79,10 @@ discard block |
||
| 79 | 79 | $this->startMethod($methodOpts); |
| 80 | 80 | $this->methodCallOnObject(TestsInterface::PARAM_I, TestsInterface::IM_GOING_TO, |
| 81 | 81 | [TestsInterface::TEST_WORD . PhpInterface::SPACE . $this->generator->objectName |
| 82 | - . PhpInterface::SPACE . MethodsInterface::VIEW]); |
|
| 82 | + . PhpInterface::SPACE . MethodsInterface::VIEW]); |
|
| 83 | 83 | $this->methodCallOnObject(TestsInterface::PARAM_I, TestsInterface::SEND_GET, |
| 84 | 84 | [PhpInterface::SLASH . $this->generator->version . PhpInterface::SLASH . mb_strtolower($this->generator->objectName) |
| 85 | - . PhpInterface::SLASH . $id]); |
|
| 85 | + . PhpInterface::SLASH . $id]); |
|
| 86 | 86 | $this->methodCallOnObject(TestsInterface::PARAM_I, TestsInterface::SEE_RESP_IS_JSON); |
| 87 | 87 | $this->methodCallOnObject(TestsInterface::PARAM_I, TestsInterface::SEE_RESP_CONTAINS_JSON, [$this->getJsonApiResponse(true)], false); |
| 88 | 88 | $this->endMethod(); |
@@ -97,10 +97,10 @@ discard block |
||
| 97 | 97 | $this->startMethod($methodOpts); |
| 98 | 98 | $this->methodCallOnObject(TestsInterface::PARAM_I, TestsInterface::IM_GOING_TO, |
| 99 | 99 | [TestsInterface::TEST_WORD . PhpInterface::SPACE . $this->generator->objectName |
| 100 | - . PhpInterface::SPACE . MethodsInterface::CREATE]); |
|
| 100 | + . PhpInterface::SPACE . MethodsInterface::CREATE]); |
|
| 101 | 101 | $this->methodCallOnObject(TestsInterface::PARAM_I, TestsInterface::SEND_POST, |
| 102 | 102 | [PhpInterface::SLASH . $this->generator->version . PhpInterface::SLASH . mb_strtolower($this->generator->objectName), |
| 103 | - $this->getJsonApiRequest()]); |
|
| 103 | + $this->getJsonApiRequest()]); |
|
| 104 | 104 | $this->methodCallOnObject(TestsInterface::PARAM_I, TestsInterface::SEE_RESP_IS_JSON); |
| 105 | 105 | $this->methodCallOnObject(TestsInterface::PARAM_I, TestsInterface::SEE_RESP_CONTAINS_JSON, [$this->getJsonApiResponse(true)], false); |
| 106 | 106 | $this->endMethod(); |
@@ -116,10 +116,10 @@ discard block |
||
| 116 | 116 | $this->startMethod($methodOpts); |
| 117 | 117 | $this->methodCallOnObject(TestsInterface::PARAM_I, TestsInterface::IM_GOING_TO, |
| 118 | 118 | [TestsInterface::TEST_WORD . PhpInterface::SPACE . $this->generator->objectName |
| 119 | - . PhpInterface::SPACE . MethodsInterface::UPDATE]); |
|
| 119 | + . PhpInterface::SPACE . MethodsInterface::UPDATE]); |
|
| 120 | 120 | $this->methodCallOnObject(TestsInterface::PARAM_I, TestsInterface::SEND_PATCH, |
| 121 | 121 | [PhpInterface::SLASH . $this->generator->version . PhpInterface::SLASH . mb_strtolower($this->generator->objectName) |
| 122 | - . PhpInterface::SLASH . $id, $this->getJsonApiRequest()]); |
|
| 122 | + . PhpInterface::SLASH . $id, $this->getJsonApiRequest()]); |
|
| 123 | 123 | $this->methodCallOnObject(TestsInterface::PARAM_I, TestsInterface::SEE_RESP_IS_JSON); |
| 124 | 124 | $this->methodCallOnObject(TestsInterface::PARAM_I, TestsInterface::SEE_RESP_CONTAINS_JSON, [$this->getJsonApiResponse(true)], false); |
| 125 | 125 | $this->endMethod(); |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | $this->startMethod($methodOpts); |
| 139 | 139 | $this->methodCallOnObject(TestsInterface::PARAM_I, TestsInterface::IM_GOING_TO, |
| 140 | 140 | [TestsInterface::TEST_WORD . PhpInterface::SPACE . $this->generator->objectName |
| 141 | - . PhpInterface::SPACE . MethodsInterface::DELETE]); |
|
| 141 | + . PhpInterface::SPACE . MethodsInterface::DELETE]); |
|
| 142 | 142 | $this->methodCallOnObject(TestsInterface::PARAM_I, TestsInterface::SEND_DELETE, |
| 143 | 143 | [PhpInterface::SLASH . $this->generator->version . PhpInterface::SLASH . mb_strtolower($this->generator->objectName) . PhpInterface::SLASH . $id]); |
| 144 | 144 | $this->endMethod(); |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | { |
| 74 | 74 | $this->setComment(CustomsInterface::CUSTOM_TYPES_ATTRIBUTES); |
| 75 | 75 | foreach ($this->generator->types[$this->generator->objectProps[ApiInterface::RAML_ATTRS]] |
| 76 | - [ApiInterface::RAML_PROPS] as $propKey => $propVal) { |
|
| 76 | + [ApiInterface::RAML_PROPS] as $propKey => $propVal) { |
|
| 77 | 77 | if (is_array($propVal)) { |
| 78 | 78 | $this->createProperty($propKey, PhpInterface::PHP_MODIFIER_PUBLIC); |
| 79 | 79 | if (empty($propVal[ApiInterface::RAML_FACETS][ConfigInterface::BIT_MASK]) === false) { |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | public function createAccessToken() |
| 228 | 228 | { |
| 229 | 229 | if (empty($this->generator->types[CustomsInterface::CUSTOM_TYPES_QUERY_PARAMS][ApiInterface::RAML_PROPS] |
| 230 | - [JSONApiInterface::PARAM_ACCESS_TOKEN][ApiInterface::RAML_KEY_DEFAULT]) === false |
|
| 230 | + [JSONApiInterface::PARAM_ACCESS_TOKEN][ApiInterface::RAML_KEY_DEFAULT]) === false |
|
| 231 | 231 | ) { |
| 232 | 232 | $this->setAccessTokenContent(); |
| 233 | 233 | $fileForm = FileManager::getModulePath($this->generator, true) . $this->generator->formRequestDir |
@@ -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 | |
@@ -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 |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | public static function createFile($fileName, $content, $isNew = false): bool |
| 27 | 27 | { |
| 28 | - if($isNew === true || file_exists($fileName) === false) |
|
| 28 | + if ($isNew === true || file_exists($fileName) === false) |
|
| 29 | 29 | { |
| 30 | 30 | $fp = fopen($fileName, self::FILE_MODE_CREATE); |
| 31 | 31 | fwrite($fp, $content); |
@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public static function createPath($path) |
| 45 | 45 | { |
| 46 | - if(is_dir($path) === false) |
|
| 46 | + if (is_dir($path) === false) |
|
| 47 | 47 | { |
| 48 | - if(mkdir($path, self::DIR_MODE, true) === false) |
|
| 48 | + if (mkdir($path, self::DIR_MODE, true) === false) |
|
| 49 | 49 | { |
| 50 | 50 | throw new DirectoryException( |
| 51 | 51 | 'Couldn`t create directory ' |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | /** @var ApiGenerator $obj */ |
| 71 | 71 | $path = |
| 72 | 72 | $obj->modulesDir . PhpInterface::SLASH . strtoupper($obj->version) . PhpInterface::SLASH; |
| 73 | - if($http === true) |
|
| 73 | + if ($http === true) |
|
| 74 | 74 | { |
| 75 | 75 | $path .= $obj->httpDir . PhpInterface::SLASH; |
| 76 | 76 | } |
@@ -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 | /** |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | public function create() |
| 44 | 44 | { |
| 45 | 45 | $migrationName = ModelsInterface::MIGRATION_CREATE . PhpInterface::UNDERSCORE . |
| 46 | - $this->tableName . |
|
| 47 | - PhpInterface::UNDERSCORE . ModelsInterface::MIGRATION_TABLE; |
|
| 46 | + $this->tableName . |
|
| 47 | + PhpInterface::UNDERSCORE . ModelsInterface::MIGRATION_TABLE; |
|
| 48 | 48 | $attrKey = $this->generator->objectName . CustomsInterface::CUSTOM_TYPES_ATTRIBUTES; |
| 49 | 49 | |
| 50 | 50 | $isFileExist = FileManager::migrationNotExists($this->generator, $migrationName); |
@@ -79,19 +79,19 @@ discard block |
||
| 79 | 79 | foreach($relations as $relationEntity) |
| 80 | 80 | { |
| 81 | 81 | $entityFile = $this->generator->formatEntitiesPath() |
| 82 | - . PhpInterface::SLASH . |
|
| 83 | - $this->generator->objectName . |
|
| 84 | - ucfirst($relationEntity) . |
|
| 85 | - PhpInterface::PHP_EXT; |
|
| 82 | + . PhpInterface::SLASH . |
|
| 83 | + $this->generator->objectName . |
|
| 84 | + ucfirst($relationEntity) . |
|
| 85 | + PhpInterface::PHP_EXT; |
|
| 86 | 86 | if(file_exists($entityFile)) |
| 87 | 87 | { |
| 88 | 88 | $this->setPivotContent($relationEntity); |
| 89 | 89 | $migrationMask = date(self::PATTERN_TIME) . random_int(10, 99); |
| 90 | 90 | $migrationName = ModelsInterface::MIGRATION_CREATE . PhpInterface::UNDERSCORE |
| 91 | - . $this->tableName |
|
| 92 | - . PhpInterface::UNDERSCORE . |
|
| 93 | - MigrationsHelper::getTableName($relationEntity) . |
|
| 94 | - PhpInterface::UNDERSCORE . ModelsInterface::MIGRATION_TABLE; |
|
| 91 | + . $this->tableName |
|
| 92 | + . PhpInterface::UNDERSCORE . |
|
| 93 | + MigrationsHelper::getTableName($relationEntity) . |
|
| 94 | + PhpInterface::UNDERSCORE . ModelsInterface::MIGRATION_TABLE; |
|
| 95 | 95 | if(FileManager::migrationNotExists($this->generator, $migrationName)) |
| 96 | 96 | { |
| 97 | 97 | $file = $this->generator->formatMigrationsPath() . $migrationMask |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | $isFileExist = FileManager::migrationNotExists($this->generator, $migrationName); |
| 51 | 51 | $isAdding = (true === $this->generator->isMerge && empty($this->generator->diffTypes[$attrKey]) === false); |
| 52 | - if(true === $isFileExist) |
|
| 52 | + if (true === $isFileExist) |
|
| 53 | 53 | { |
| 54 | 54 | $this->setContent(); |
| 55 | 55 | } else if (true === $isAdding) { |
@@ -73,17 +73,17 @@ discard block |
||
| 73 | 73 | $formRequestEntity = $this->getFormRequestEntity($this->generator->version, $this->className); |
| 74 | 74 | /** @var BaseFormRequest $formRequest **/ |
| 75 | 75 | $formRequest = new $formRequestEntity(); |
| 76 | - if(method_exists($formRequest, ModelsInterface::MODEL_METHOD_RELATIONS)) |
|
| 76 | + if (method_exists($formRequest, ModelsInterface::MODEL_METHOD_RELATIONS)) |
|
| 77 | 77 | { |
| 78 | 78 | $relations = $formRequest->relations(); |
| 79 | - foreach($relations as $relationEntity) |
|
| 79 | + foreach ($relations as $relationEntity) |
|
| 80 | 80 | { |
| 81 | 81 | $entityFile = $this->generator->formatEntitiesPath() |
| 82 | 82 | . PhpInterface::SLASH . |
| 83 | 83 | $this->generator->objectName . |
| 84 | 84 | ucfirst($relationEntity) . |
| 85 | 85 | PhpInterface::PHP_EXT; |
| 86 | - if(file_exists($entityFile)) |
|
| 86 | + if (file_exists($entityFile)) |
|
| 87 | 87 | { |
| 88 | 88 | $this->setPivotContent($relationEntity); |
| 89 | 89 | $migrationMask = date(self::PATTERN_TIME) . random_int(10, 99); |
@@ -92,13 +92,13 @@ discard block |
||
| 92 | 92 | . PhpInterface::UNDERSCORE . |
| 93 | 93 | MigrationsHelper::getTableName($relationEntity) . |
| 94 | 94 | PhpInterface::UNDERSCORE . ModelsInterface::MIGRATION_TABLE; |
| 95 | - if(FileManager::migrationNotExists($this->generator, $migrationName)) |
|
| 95 | + if (FileManager::migrationNotExists($this->generator, $migrationName)) |
|
| 96 | 96 | { |
| 97 | 97 | $file = $this->generator->formatMigrationsPath() . $migrationMask |
| 98 | 98 | . PhpInterface::UNDERSCORE . $migrationName . PhpInterface::PHP_EXT; |
| 99 | 99 | // if migration file with the same name ocasionally exists we do not override it |
| 100 | 100 | $isCreated = FileManager::createFile($file, $this->sourceCode); |
| 101 | - if($isCreated) |
|
| 101 | + if ($isCreated) |
|
| 102 | 102 | { |
| 103 | 103 | Console::out($file . PhpInterface::SPACE . Console::CREATED, Console::COLOR_GREEN); |
| 104 | 104 | } |