@@ -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'"); |
@@ -146,6 +146,11 @@ discard block |
||
146 | 146 | ]; |
147 | 147 | } |
148 | 148 | |
149 | + /** |
|
150 | + * @param string $type |
|
151 | + * @param string $varName |
|
152 | + * @param string $func |
|
153 | + */ |
|
149 | 154 | private function getExtraVarDef($type, $varName, $func) |
150 | 155 | { |
151 | 156 | $info = [ |
@@ -173,6 +178,9 @@ discard block |
||
173 | 178 | return false; |
174 | 179 | } |
175 | 180 | |
181 | + /** |
|
182 | + * @param string $type |
|
183 | + */ |
|
176 | 184 | private function getVariableTypeOption($type) |
177 | 185 | { |
178 | 186 | $types = $this->getVariableTypesOptions(); |
@@ -180,11 +188,17 @@ discard block |
||
180 | 188 | return $types[$type]; |
181 | 189 | } |
182 | 190 | |
191 | + /** |
|
192 | + * @param string $type |
|
193 | + */ |
|
183 | 194 | private function hasVariableTypeOption($type) |
184 | 195 | { |
185 | 196 | return array_key_exists($type, $this->getVariableTypesOptions()); |
186 | 197 | } |
187 | 198 | |
199 | + /** |
|
200 | + * @param string $prefix |
|
201 | + */ |
|
188 | 202 | private function placeholderCreator($prefix) |
189 | 203 | { |
190 | 204 | $this->output(PHP_EOL.'-> Create new '.$prefix, Console::FG_YELLOW); |
@@ -397,7 +397,7 @@ |
||
397 | 397 | * |
398 | 398 | * @see ArrayAccess::offsetGet() |
399 | 399 | * @param string $offset The key to get from the array. |
400 | - * @return mixed The value for the offset key from the array. |
|
400 | + * @return string|boolean The value for the offset key from the array. |
|
401 | 401 | */ |
402 | 402 | public function offsetGet($offset) |
403 | 403 | { |
@@ -14,9 +14,9 @@ discard block |
||
14 | 14 | */ |
15 | 15 | class FloatValidator extends Validator |
16 | 16 | { |
17 | - /** |
|
18 | - * @var string The messaged to send when an error appears. |
|
19 | - */ |
|
17 | + /** |
|
18 | + * @var string The messaged to send when an error appears. |
|
19 | + */ |
|
20 | 20 | public $message = '{attribute} must be a float or numeric value.'; |
21 | 21 | |
22 | 22 | /** |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | { |
29 | 29 | $value = $model->$attribute; |
30 | 30 | if (!is_numeric($value) && !is_float($value)) { |
31 | - return $model->addError($attribute, Yii::t('yii', $this->message, ['attribute' => $model->getAttributeLabel($attribute)])); |
|
31 | + return $model->addError($attribute, Yii::t('yii', $this->message, ['attribute' => $model->getAttributeLabel($attribute)])); |
|
32 | 32 | } |
33 | 33 | } |
34 | 34 | } |
@@ -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 | } |