@@ -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 ' |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | $path = ApiInterface::DEFAULT_VERSION . PhpInterface::SLASH; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - if($http === true) |
|
| 78 | + if ($http === true) |
|
| 79 | 79 | { |
| 80 | 80 | $path .= $obj->httpDir . PhpInterface::SLASH; |
| 81 | 81 | } |
@@ -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 | $isFileExist = FileManager::migrationNotExists($this->generator, $migrationName); |
@@ -80,20 +80,20 @@ discard block |
||
| 80 | 80 | foreach($relations as $relationEntity) |
| 81 | 81 | { |
| 82 | 82 | $entityFile = $this->generator->formatEntitiesPath() |
| 83 | - . PhpInterface::SLASH . |
|
| 84 | - $this->generator->objectName . |
|
| 85 | - ucfirst($relationEntity) . |
|
| 86 | - PhpInterface::PHP_EXT; |
|
| 83 | + . PhpInterface::SLASH . |
|
| 84 | + $this->generator->objectName . |
|
| 85 | + ucfirst($relationEntity) . |
|
| 86 | + PhpInterface::PHP_EXT; |
|
| 87 | 87 | if(file_exists($entityFile)) |
| 88 | 88 | { |
| 89 | 89 | $this->setPivotContent($relationEntity); |
| 90 | 90 | |
| 91 | 91 | $migrationMask = date(self::PATTERN_TIME) . (self::$counter + 1); |
| 92 | 92 | $migrationName = ModelsInterface::MIGRATION_CREATE . PhpInterface::UNDERSCORE |
| 93 | - . $this->tableName |
|
| 94 | - . PhpInterface::UNDERSCORE . |
|
| 95 | - MigrationsHelper::getTableName($relationEntity) . |
|
| 96 | - PhpInterface::UNDERSCORE . ModelsInterface::MIGRATION_TABLE; |
|
| 93 | + . $this->tableName |
|
| 94 | + . PhpInterface::UNDERSCORE . |
|
| 95 | + MigrationsHelper::getTableName($relationEntity) . |
|
| 96 | + PhpInterface::UNDERSCORE . ModelsInterface::MIGRATION_TABLE; |
|
| 97 | 97 | |
| 98 | 98 | if(FileManager::migrationNotExists($this->generator, $migrationName)) |
| 99 | 99 | { |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | $isFileExist = FileManager::migrationNotExists($this->generator, $migrationName); |
| 52 | 52 | $isAdding = (true === $this->generator->isMerge && empty($this->generator->diffTypes[$attrKey]) === false); |
| 53 | - if(true === $isFileExist) |
|
| 53 | + if (true === $isFileExist) |
|
| 54 | 54 | { |
| 55 | 55 | $this->setContent(); |
| 56 | 56 | } else if (true === $isAdding) { |
@@ -74,17 +74,17 @@ discard block |
||
| 74 | 74 | $formRequestEntity = $this->getFormRequestEntity($this->generator->version, $this->className); |
| 75 | 75 | /** @var BaseFormRequest $formRequest **/ |
| 76 | 76 | $formRequest = new $formRequestEntity(); |
| 77 | - if(method_exists($formRequest, ModelsInterface::MODEL_METHOD_RELATIONS)) |
|
| 77 | + if (method_exists($formRequest, ModelsInterface::MODEL_METHOD_RELATIONS)) |
|
| 78 | 78 | { |
| 79 | 79 | $relations = $formRequest->relations(); |
| 80 | - foreach($relations as $relationEntity) |
|
| 80 | + foreach ($relations as $relationEntity) |
|
| 81 | 81 | { |
| 82 | 82 | $entityFile = $this->generator->formatEntitiesPath() |
| 83 | 83 | . PhpInterface::SLASH . |
| 84 | 84 | $this->generator->objectName . |
| 85 | 85 | ucfirst($relationEntity) . |
| 86 | 86 | PhpInterface::PHP_EXT; |
| 87 | - if(file_exists($entityFile)) |
|
| 87 | + if (file_exists($entityFile)) |
|
| 88 | 88 | { |
| 89 | 89 | $this->setPivotContent($relationEntity); |
| 90 | 90 | |
@@ -95,13 +95,13 @@ discard block |
||
| 95 | 95 | MigrationsHelper::getTableName($relationEntity) . |
| 96 | 96 | PhpInterface::UNDERSCORE . ModelsInterface::MIGRATION_TABLE; |
| 97 | 97 | |
| 98 | - if(FileManager::migrationNotExists($this->generator, $migrationName)) |
|
| 98 | + if (FileManager::migrationNotExists($this->generator, $migrationName)) |
|
| 99 | 99 | { |
| 100 | 100 | $file = $this->generator->formatMigrationsPath() . $migrationMask |
| 101 | 101 | . PhpInterface::UNDERSCORE . $migrationName . PhpInterface::PHP_EXT; |
| 102 | 102 | // if migration file with the same name ocasionally exists we do not override it |
| 103 | 103 | $isCreated = FileManager::createFile($file, $this->sourceCode); |
| 104 | - if($isCreated) |
|
| 104 | + if ($isCreated) |
|
| 105 | 105 | { |
| 106 | 106 | Console::out($file . PhpInterface::SPACE . Console::CREATED, Console::COLOR_GREEN); |
| 107 | 107 | } |