@@ -19,5 +19,5 @@ |
||
| 19 | 19 | /** |
| 20 | 20 | * @var string $modelClass The path to the model which is the provider for the rules and fields. |
| 21 | 21 | */ |
| 22 | - public $modelClass = '<?= $modelClass;?>'; |
|
| 22 | + public $modelClass = '<?= $modelClass; ?>'; |
|
| 23 | 23 | } |
| 24 | 24 | \ No newline at end of file |
@@ -10,8 +10,8 @@ discard block |
||
| 10 | 10 | /** |
| 11 | 11 | * NgRest Model created with LUYA Version <?php echo $luyaVersion; ?>. |
| 12 | 12 | * |
| 13 | -<?php foreach ($properties as $name => $type): ?> * @property <?= $type; ?> $<?= $name . PHP_EOL; ?> |
|
| 14 | -<?php endforeach;?> |
|
| 13 | +<?php foreach ($properties as $name => $type): ?> * @property <?= $type; ?> $<?= $name.PHP_EOL; ?> |
|
| 14 | +<?php endforeach; ?> |
|
| 15 | 15 | */ |
| 16 | 16 | class <?= $className; ?> extends NgRestModel |
| 17 | 17 | { |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public $i18n = ['<?= implode("', '", $textFields); ?>']; |
| 53 | 53 | |
| 54 | -<?php endif;?> |
|
| 54 | +<?php endif; ?> |
|
| 55 | 55 | /** |
| 56 | 56 | * @inheritdoc |
| 57 | 57 | */ |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | { |
| 87 | 87 | return [ |
| 88 | 88 | <?php foreach ($ngrestFieldConfig as $name => $type): ?> |
| 89 | - '<?=$name; ?>' => '<?= $type;?>', |
|
| 89 | + '<?=$name; ?>' => '<?= $type; ?>', |
|
| 90 | 90 | <?php endforeach; ?>]; |
| 91 | 91 | } |
| 92 | 92 | |
@@ -146,19 +146,19 @@ discard block |
||
| 146 | 146 | private function getExtraVarDef($type, $varName, $func) |
| 147 | 147 | { |
| 148 | 148 | $info = [ |
| 149 | - 'image-upload' => function ($varName) use ($func) { |
|
| 149 | + 'image-upload' => function($varName) use ($func) { |
|
| 150 | 150 | return 'BlockHelper::imageUpload($this->'.$func.'(\''.$varName.'\'), false, true),'; |
| 151 | 151 | }, |
| 152 | - 'image-array-upload' => function ($varName) use ($func) { |
|
| 152 | + 'image-array-upload' => function($varName) use ($func) { |
|
| 153 | 153 | return 'BlockHelper::imageArrayUpload($this->'.$func.'(\''.$varName.'\'), false, true),'; |
| 154 | 154 | }, |
| 155 | - 'file-upload' => function ($varName) use ($func) { |
|
| 155 | + 'file-upload' => function($varName) use ($func) { |
|
| 156 | 156 | return 'BlockHelper::fileUpload($this->'.$func.'(\''.$varName.'\'), true),'; |
| 157 | 157 | }, |
| 158 | - 'file-array-upload' => function ($varName) use ($func) { |
|
| 158 | + 'file-array-upload' => function($varName) use ($func) { |
|
| 159 | 159 | return 'BlockHelper::fileArrayUpload($this->'.$func.'(\''.$varName.'\'), true),'; |
| 160 | 160 | }, |
| 161 | - 'cms-page' => function ($varName) use ($func) { |
|
| 161 | + 'cms-page' => function($varName) use ($func) { |
|
| 162 | 162 | return 'Yii::$app->menu->findOne([\'nav_id\' => $this->'.$func.'(\''.$varName.'\', 0)]),'; |
| 163 | 163 | }, |
| 164 | 164 | ]; |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | return 'app\\blocks'; |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | - return Yii::$app->getModule($this->moduleName)->getNamespace() . '\\blocks'; |
|
| 249 | + return Yii::$app->getModule($this->moduleName)->getNamespace().'\\blocks'; |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | protected function getFileBasePath() |
@@ -343,8 +343,8 @@ discard block |
||
| 343 | 343 | } |
| 344 | 344 | } |
| 345 | 345 | |
| 346 | - $folder = $this->getFileBasePath() . DIRECTORY_SEPARATOR . 'blocks'; |
|
| 347 | - $filePath = $folder . DIRECTORY_SEPARATOR . $this->blockName . '.php'; |
|
| 346 | + $folder = $this->getFileBasePath().DIRECTORY_SEPARATOR.'blocks'; |
|
| 347 | + $filePath = $folder.DIRECTORY_SEPARATOR.$this->blockName.'.php'; |
|
| 348 | 348 | |
| 349 | 349 | sort($this->phpdoc); |
| 350 | 350 | |
@@ -368,14 +368,14 @@ discard block |
||
| 368 | 368 | if (FileHelper::createDirectory($folder) && FileHelper::writeFile($filePath, $content)) { |
| 369 | 369 | |
| 370 | 370 | // generate view file based on block object view context |
| 371 | - $object = Yii::createObject(['class' => $this->getFileNamespace() . '\\' . $this->blockName]); |
|
| 371 | + $object = Yii::createObject(['class' => $this->getFileNamespace().'\\'.$this->blockName]); |
|
| 372 | 372 | $viewsFolder = Yii::getAlias($object->getViewPath()); |
| 373 | - $viewFilePath = $viewsFolder . DIRECTORY_SEPARATOR . $object->getViewFileName('php'); |
|
| 373 | + $viewFilePath = $viewsFolder.DIRECTORY_SEPARATOR.$object->getViewFileName('php'); |
|
| 374 | 374 | if (FileHelper::createDirectory($viewsFolder) && FileHelper::writeFile($viewFilePath, $this->generateViewFile($this->blockName))) { |
| 375 | - $this->outputInfo('View file for the block has been created: ' . $viewFilePath); |
|
| 375 | + $this->outputInfo('View file for the block has been created: '.$viewFilePath); |
|
| 376 | 376 | } |
| 377 | 377 | |
| 378 | - return $this->outputSuccess("Block {$this->blockName} has been created: " . $filePath); |
|
| 378 | + return $this->outputSuccess("Block {$this->blockName} has been created: ".$filePath); |
|
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | return $this->outputError("Error while creating block '$filePath'"); |
@@ -100,7 +100,7 @@ |
||
| 100 | 100 | // see if the module has a registerComponents method |
| 101 | 101 | foreach ($module->registerComponents() as $componentId => $definition) { |
| 102 | 102 | if (!$app->has($componentId)) { |
| 103 | - Yii::trace('Register component ' . $componentId, __METHOD__); |
|
| 103 | + Yii::trace('Register component '.$componentId, __METHOD__); |
|
| 104 | 104 | $app->set($componentId, $definition); |
| 105 | 105 | } |
| 106 | 106 | } |
@@ -55,11 +55,11 @@ |
||
| 55 | 55 | |
| 56 | 56 | $module = Yii::$app->getModule($moduleId); |
| 57 | 57 | |
| 58 | - $folder = $module->basePath . DIRECTORY_SEPARATOR . 'aws'; |
|
| 58 | + $folder = $module->basePath.DIRECTORY_SEPARATOR.'aws'; |
|
| 59 | 59 | |
| 60 | - $file = $folder . DIRECTORY_SEPARATOR . $className . '.php'; |
|
| 60 | + $file = $folder.DIRECTORY_SEPARATOR.$className.'.php'; |
|
| 61 | 61 | |
| 62 | - $content = $this->renderWindowClassView($className, $module->getNamespace() . '\\aws', $moduleId); |
|
| 62 | + $content = $this->renderWindowClassView($className, $module->getNamespace().'\\aws', $moduleId); |
|
| 63 | 63 | |
| 64 | 64 | FileHelper::createDirectory($folder); |
| 65 | 65 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public function getAbsoluteModelNamespace() |
| 81 | 81 | { |
| 82 | - return $this->getModelNamespace() . '\\models\\' . $this->getModelNameCamlized(); |
|
| 82 | + return $this->getModelNamespace().'\\models\\'.$this->getModelNameCamlized(); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | $sqlTable = $this->prompt('Database Table name for the Model:', ['required' => true, 'default' => $this->getDatabaseNameSuggestion()]); |
| 376 | 376 | if ($sqlTable == '?') { |
| 377 | 377 | foreach ($this->getSqlTablesArray() as $table) { |
| 378 | - $this->outputInfo("- " . $table); |
|
| 378 | + $this->outputInfo("- ".$table); |
|
| 379 | 379 | } |
| 380 | 380 | } |
| 381 | 381 | if (isset($this->getSqlTablesArray()[$sqlTable])) { |
@@ -398,26 +398,26 @@ discard block |
||
| 398 | 398 | // api content |
| 399 | 399 | |
| 400 | 400 | $files['api'] = [ |
| 401 | - 'path' => $this->getBasePath() . DIRECTORY_SEPARATOR . 'apis', |
|
| 402 | - 'fileName' => $this->getModelNameCamlized() . 'Controller.php', |
|
| 403 | - 'content' => $this->generateApiContent($this->getNamespace() . '\\apis', $this->getModelNameCamlized() . 'Controller', $this->getAbsoluteModelNamespace()), |
|
| 401 | + 'path' => $this->getBasePath().DIRECTORY_SEPARATOR.'apis', |
|
| 402 | + 'fileName' => $this->getModelNameCamlized().'Controller.php', |
|
| 403 | + 'content' => $this->generateApiContent($this->getNamespace().'\\apis', $this->getModelNameCamlized().'Controller', $this->getAbsoluteModelNamespace()), |
|
| 404 | 404 | ]; |
| 405 | 405 | |
| 406 | 406 | // controller |
| 407 | 407 | |
| 408 | 408 | $files['controller'] = [ |
| 409 | - 'path' => $this->getBasePath() . DIRECTORY_SEPARATOR . 'controllers', |
|
| 410 | - 'fileName' => $this->getModelNameCamlized() . 'Controller.php', |
|
| 411 | - 'content' => $this->generateControllerContent($this->getNamespace() . '\\controllers', $this->getModelNameCamlized() . 'Controller', $this->getAbsoluteModelNamespace()), |
|
| 409 | + 'path' => $this->getBasePath().DIRECTORY_SEPARATOR.'controllers', |
|
| 410 | + 'fileName' => $this->getModelNameCamlized().'Controller.php', |
|
| 411 | + 'content' => $this->generateControllerContent($this->getNamespace().'\\controllers', $this->getModelNameCamlized().'Controller', $this->getAbsoluteModelNamespace()), |
|
| 412 | 412 | ]; |
| 413 | 413 | |
| 414 | 414 | // model |
| 415 | 415 | |
| 416 | 416 | $files['model'] = [ |
| 417 | - 'path' => $this->getModelBasePath() . DIRECTORY_SEPARATOR . 'models', |
|
| 418 | - 'fileName' => $this->getModelNameCamlized() . '.php', |
|
| 417 | + 'path' => $this->getModelBasePath().DIRECTORY_SEPARATOR.'models', |
|
| 418 | + 'fileName' => $this->getModelNameCamlized().'.php', |
|
| 419 | 419 | 'content' => $this->generateModelContent( |
| 420 | - $this->getModelNamespace() . '\\models', |
|
| 420 | + $this->getModelNamespace().'\\models', |
|
| 421 | 421 | $this->getModelNameCamlized(), |
| 422 | 422 | $this->apiEndpoint, |
| 423 | 423 | $this->getDbTableShema(), |
@@ -427,19 +427,19 @@ discard block |
||
| 427 | 427 | |
| 428 | 428 | foreach ($files as $file) { |
| 429 | 429 | FileHelper::createDirectory($file['path']); |
| 430 | - if (file_exists($file['path'] . DIRECTORY_SEPARATOR . $file['fileName'])) { |
|
| 430 | + if (file_exists($file['path'].DIRECTORY_SEPARATOR.$file['fileName'])) { |
|
| 431 | 431 | if (!$this->confirm("The File '{$file['fileName']}' already exists, do you want to override the existing file?")) { |
| 432 | 432 | continue; |
| 433 | 433 | } |
| 434 | 434 | } |
| 435 | 435 | |
| 436 | - if (FileHelper::writeFile($file['path'] . DIRECTORY_SEPARATOR . $file['fileName'], $file['content'])) { |
|
| 436 | + if (FileHelper::writeFile($file['path'].DIRECTORY_SEPARATOR.$file['fileName'], $file['content'])) { |
|
| 437 | 437 | $this->outputSuccess("Wrote file '{$file['fileName']}'."); |
| 438 | 438 | } else { |
| 439 | 439 | $this->outputError("Error while writing file '{$file['fileName']}'."); |
| 440 | 440 | } |
| 441 | 441 | } |
| 442 | 442 | |
| 443 | - return $this->outputSuccess($this->generateBuildSummery($this->apiEndpoint, $this->getNamespace() . '\\apis\\' . $this->getModelNameCamlized() . 'Controller', $this->getModelNameCamlized(), $this->getSummaryControllerRoute())); |
|
| 443 | + return $this->outputSuccess($this->generateBuildSummery($this->apiEndpoint, $this->getNamespace().'\\apis\\'.$this->getModelNameCamlized().'Controller', $this->getModelNameCamlized(), $this->getSummaryControllerRoute())); |
|
| 444 | 444 | } |
| 445 | 445 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | $route = $parsedRequest[0]; |
| 72 | 72 | |
| 73 | 73 | |
| 74 | - if (substr($route, 0, $length+1) == $composition.'/') { |
|
| 74 | + if (substr($route, 0, $length + 1) == $composition.'/') { |
|
| 75 | 75 | $parsedRequest[0] = substr($parsedRequest[0], $length); |
| 76 | 76 | } |
| 77 | 77 | |
@@ -267,10 +267,10 @@ discard block |
||
| 267 | 267 | $params = (array) $params; |
| 268 | 268 | $url = $this->internalCreateUrl($params); |
| 269 | 269 | if (strpos($url, '://') === false) { |
| 270 | - $url = $this->getHostInfo() . $url; |
|
| 270 | + $url = $this->getHostInfo().$url; |
|
| 271 | 271 | } |
| 272 | 272 | if (is_string($scheme) && ($pos = strpos($url, '://')) !== false) { |
| 273 | - $url = $scheme . substr($url, $pos); |
|
| 273 | + $url = $scheme.substr($url, $pos); |
|
| 274 | 274 | } |
| 275 | 275 | return $url; |
| 276 | 276 | } |
@@ -164,18 +164,18 @@ |
||
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | foreach ($this->getLog() as $section => $value) { |
| 167 | - $this->outputInfo(PHP_EOL . $section . ":"); |
|
| 167 | + $this->outputInfo(PHP_EOL.$section.":"); |
|
| 168 | 168 | foreach ($value as $k => $v) { |
| 169 | 169 | if (is_array($v)) { |
| 170 | 170 | foreach ($v as $kk => $kv) { |
| 171 | 171 | if (is_array($kv)) { |
| 172 | - $this->output(" - {$kk}: " . print_r($kv, true)); |
|
| 172 | + $this->output(" - {$kk}: ".print_r($kv, true)); |
|
| 173 | 173 | } else { |
| 174 | 174 | $this->output(" - {$kk}: {$kv}"); |
| 175 | 175 | } |
| 176 | 176 | } |
| 177 | 177 | } else { |
| 178 | - $this->output(" - " . $v); |
|
| 178 | + $this->output(" - ".$v); |
|
| 179 | 179 | } |
| 180 | 180 | } |
| 181 | 181 | } |
@@ -100,22 +100,22 @@ discard block |
||
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - $appModulesFolder = Yii::$app->basePath . DIRECTORY_SEPARATOR . 'modules'; |
|
| 104 | - $moduleFolder = $appModulesFolder . DIRECTORY_SEPARATOR . $moduleName; |
|
| 103 | + $appModulesFolder = Yii::$app->basePath.DIRECTORY_SEPARATOR.'modules'; |
|
| 104 | + $moduleFolder = $appModulesFolder.DIRECTORY_SEPARATOR.$moduleName; |
|
| 105 | 105 | |
| 106 | 106 | if (file_exists($moduleFolder)) { |
| 107 | - return $this->outputError("The folder " . $moduleFolder . " exists already."); |
|
| 107 | + return $this->outputError("The folder ".$moduleFolder." exists already."); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | $folders = [ |
| 111 | 111 | 'basePath' => $moduleFolder, |
| 112 | - 'adminPath' => $moduleFolder . DIRECTORY_SEPARATOR . 'admin', |
|
| 113 | - 'adminAwsPath' => $moduleFolder . DIRECTORY_SEPARATOR . 'admin' . DIRECTORY_SEPARATOR . 'aws', |
|
| 114 | - 'frontendPath' => $moduleFolder . DIRECTORY_SEPARATOR . 'frontend', |
|
| 115 | - 'frontendBlocksPath' => $moduleFolder . DIRECTORY_SEPARATOR . 'frontend' . DIRECTORY_SEPARATOR . 'blocks', |
|
| 116 | - 'frontendControllersPath' => $moduleFolder . DIRECTORY_SEPARATOR . 'frontend' . DIRECTORY_SEPARATOR . 'controllers', |
|
| 117 | - 'frontendViewsPath' => $moduleFolder . DIRECTORY_SEPARATOR . 'frontend' . DIRECTORY_SEPARATOR . 'views', |
|
| 118 | - 'modelsPath' => $moduleFolder . DIRECTORY_SEPARATOR . 'models', |
|
| 112 | + 'adminPath' => $moduleFolder.DIRECTORY_SEPARATOR.'admin', |
|
| 113 | + 'adminAwsPath' => $moduleFolder.DIRECTORY_SEPARATOR.'admin'.DIRECTORY_SEPARATOR.'aws', |
|
| 114 | + 'frontendPath' => $moduleFolder.DIRECTORY_SEPARATOR.'frontend', |
|
| 115 | + 'frontendBlocksPath' => $moduleFolder.DIRECTORY_SEPARATOR.'frontend'.DIRECTORY_SEPARATOR.'blocks', |
|
| 116 | + 'frontendControllersPath' => $moduleFolder.DIRECTORY_SEPARATOR.'frontend'.DIRECTORY_SEPARATOR.'controllers', |
|
| 117 | + 'frontendViewsPath' => $moduleFolder.DIRECTORY_SEPARATOR.'frontend'.DIRECTORY_SEPARATOR.'views', |
|
| 118 | + 'modelsPath' => $moduleFolder.DIRECTORY_SEPARATOR.'models', |
|
| 119 | 119 | ]; |
| 120 | 120 | |
| 121 | 121 | $ns = 'app\\modules\\'.$moduleName; |
@@ -125,9 +125,9 @@ discard block |
||
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | $contents = [ |
| 128 | - $moduleFolder. DIRECTORY_SEPARATOR . 'README.md' => $this->renderReadme($folders, $moduleName, $ns), |
|
| 129 | - $moduleFolder. DIRECTORY_SEPARATOR . 'admin/Module.php' => $this->renderAdmin($folders, $moduleName, $ns), |
|
| 130 | - $moduleFolder. DIRECTORY_SEPARATOR . 'frontend/Module.php' => $this->renderFrontend($folders, $moduleName, $ns), |
|
| 128 | + $moduleFolder.DIRECTORY_SEPARATOR.'README.md' => $this->renderReadme($folders, $moduleName, $ns), |
|
| 129 | + $moduleFolder.DIRECTORY_SEPARATOR.'admin/Module.php' => $this->renderAdmin($folders, $moduleName, $ns), |
|
| 130 | + $moduleFolder.DIRECTORY_SEPARATOR.'frontend/Module.php' => $this->renderFrontend($folders, $moduleName, $ns), |
|
| 131 | 131 | ]; |
| 132 | 132 | |
| 133 | 133 | foreach ($contents as $fileName => $content) { |