@@ -70,14 +70,14 @@ |
||
| 70 | 70 | */ |
| 71 | 71 | public function run() |
| 72 | 72 | { |
| 73 | - $class = 'lazy-image ' . $this->extraClass; |
|
| 73 | + $class = 'lazy-image '.$this->extraClass; |
|
| 74 | 74 | |
| 75 | 75 | if ($this->attributesOnly) { |
| 76 | 76 | return "class=\"{$class}\" data-src=\"$this->src\" data-width=\"$this->width\" data-height=\"$this->height\" data-as-background=\"1\""; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | $tag = Html::tag('img', '', ['class' => $class, 'data-src' => $this->src, 'data-width' => $this->width, 'data-height' => $this->height]); |
| 80 | - $tag.= '<noscript><img class="'.$class.'" src="'.$this->src.'" /></noscript>'; |
|
| 80 | + $tag .= '<noscript><img class="'.$class.'" src="'.$this->src.'" /></noscript>'; |
|
| 81 | 81 | return $tag; |
| 82 | 82 | } |
| 83 | 83 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | if ($sqlTable == '?') { |
| 58 | 58 | foreach ($this->getSqlTablesArray() as $table) { |
| 59 | - $this->outputInfo("- " . $table); |
|
| 59 | + $this->outputInfo("- ".$table); |
|
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | |
@@ -153,8 +153,8 @@ discard block |
||
| 153 | 153 | case 'model': |
| 154 | 154 | |
| 155 | 155 | if (!$extended) { |
| 156 | - $modelName = $modelName . 'NgRest'; |
|
| 157 | - $item['file'] = $modelName . '.php'; |
|
| 156 | + $modelName = $modelName.'NgRest'; |
|
| 157 | + $item['file'] = $modelName.'.php'; |
|
| 158 | 158 | $item['class'] = $modelName; |
| 159 | 159 | } |
| 160 | 160 | |
@@ -34,22 +34,22 @@ discard block |
||
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - $appModulesFolder = Yii::$app->basePath . DIRECTORY_SEPARATOR . 'modules'; |
|
| 38 | - $moduleFolder = $appModulesFolder . DIRECTORY_SEPARATOR . $moduleName; |
|
| 37 | + $appModulesFolder = Yii::$app->basePath.DIRECTORY_SEPARATOR.'modules'; |
|
| 38 | + $moduleFolder = $appModulesFolder.DIRECTORY_SEPARATOR.$moduleName; |
|
| 39 | 39 | |
| 40 | 40 | if (file_exists($moduleFolder)) { |
| 41 | - return $this->outputError("The folder " . $moduleFolder . " exists already."); |
|
| 41 | + return $this->outputError("The folder ".$moduleFolder." exists already."); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | $folders = [ |
| 45 | 45 | 'basePath' => $moduleFolder, |
| 46 | - 'adminPath' => $moduleFolder . DIRECTORY_SEPARATOR . 'admin', |
|
| 47 | - 'adminPath' => $moduleFolder . DIRECTORY_SEPARATOR . 'admin' . DIRECTORY_SEPARATOR . 'aws', |
|
| 48 | - 'frontendPath' => $moduleFolder . DIRECTORY_SEPARATOR . 'frontend', |
|
| 49 | - 'blocksPath' => $moduleFolder . DIRECTORY_SEPARATOR . 'frontend' . DIRECTORY_SEPARATOR . 'blocks', |
|
| 50 | - 'blocksPath' => $moduleFolder . DIRECTORY_SEPARATOR . 'frontend' . DIRECTORY_SEPARATOR . 'controllers', |
|
| 51 | - 'blocksPath' => $moduleFolder . DIRECTORY_SEPARATOR . 'frontend' . DIRECTORY_SEPARATOR . 'views', |
|
| 52 | - 'modelsPath' => $moduleFolder . DIRECTORY_SEPARATOR . 'models', |
|
| 46 | + 'adminPath' => $moduleFolder.DIRECTORY_SEPARATOR.'admin', |
|
| 47 | + 'adminPath' => $moduleFolder.DIRECTORY_SEPARATOR.'admin'.DIRECTORY_SEPARATOR.'aws', |
|
| 48 | + 'frontendPath' => $moduleFolder.DIRECTORY_SEPARATOR.'frontend', |
|
| 49 | + 'blocksPath' => $moduleFolder.DIRECTORY_SEPARATOR.'frontend'.DIRECTORY_SEPARATOR.'blocks', |
|
| 50 | + 'blocksPath' => $moduleFolder.DIRECTORY_SEPARATOR.'frontend'.DIRECTORY_SEPARATOR.'controllers', |
|
| 51 | + 'blocksPath' => $moduleFolder.DIRECTORY_SEPARATOR.'frontend'.DIRECTORY_SEPARATOR.'views', |
|
| 52 | + 'modelsPath' => $moduleFolder.DIRECTORY_SEPARATOR.'models', |
|
| 53 | 53 | ]; |
| 54 | 54 | |
| 55 | 55 | $vars = ['folders' => $folders, 'name' => $moduleName, 'ns' => 'app\\modules\\'.$moduleName]; |
@@ -59,9 +59,9 @@ discard block |
||
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | $contents = [ |
| 62 | - $moduleFolder. DIRECTORY_SEPARATOR . 'README.md' => $this->view->render('@luya/console/commands/views/module/readme.php', $vars), |
|
| 63 | - $moduleFolder. DIRECTORY_SEPARATOR . 'admin/Module.php' => $this->view->render('@luya/console/commands/views/module/adminmodule.php', $vars), |
|
| 64 | - $moduleFolder. DIRECTORY_SEPARATOR . 'frontend/Module.php' => $this->view->render('@luya/console/commands/views/module/frontendmodule.php', $vars), |
|
| 62 | + $moduleFolder.DIRECTORY_SEPARATOR.'README.md' => $this->view->render('@luya/console/commands/views/module/readme.php', $vars), |
|
| 63 | + $moduleFolder.DIRECTORY_SEPARATOR.'admin/Module.php' => $this->view->render('@luya/console/commands/views/module/adminmodule.php', $vars), |
|
| 64 | + $moduleFolder.DIRECTORY_SEPARATOR.'frontend/Module.php' => $this->view->render('@luya/console/commands/views/module/frontendmodule.php', $vars), |
|
| 65 | 65 | ]; |
| 66 | 66 | |
| 67 | 67 | foreach ($contents as $fileName => $content) { |
@@ -50,9 +50,9 @@ discard block |
||
| 50 | 50 | foreach ($array as $k => $v) { |
| 51 | 51 | if (is_numeric($v)) { |
| 52 | 52 | if (is_float($v)) { |
| 53 | - $return[$k] = (float)$v; |
|
| 53 | + $return[$k] = (float) $v; |
|
| 54 | 54 | } else { |
| 55 | - $return[$k] = (int)$v; |
|
| 55 | + $return[$k] = (int) $v; |
|
| 56 | 56 | } |
| 57 | 57 | } elseif (is_array($v)) { |
| 58 | 58 | $return[$k] = self::typeCast($v); |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | public static function search($array, $searchText, $sensitive = false) |
| 93 | 93 | { |
| 94 | 94 | $function = ($sensitive) ? 'strpos' : 'stripos'; |
| 95 | - return array_filter($array, function ($item) use ($searchText, $function) { |
|
| 95 | + return array_filter($array, function($item) use ($searchText, $function) { |
|
| 96 | 96 | $response = false; |
| 97 | 97 | foreach ($item as $key => $value) { |
| 98 | 98 | if ($response) { |
@@ -74,10 +74,10 @@ discard block |
||
| 74 | 74 | } |
| 75 | 75 | $rules = []; |
| 76 | 76 | foreach ($types as $type => $columns) { |
| 77 | - $rules[] = "[['" . implode("', '", $columns) . "'], '$type']"; |
|
| 77 | + $rules[] = "[['".implode("', '", $columns)."'], '$type']"; |
|
| 78 | 78 | } |
| 79 | 79 | foreach ($lengths as $length => $columns) { |
| 80 | - $rules[] = "[['" . implode("', '", $columns) . "'], 'string', 'max' => $length]"; |
|
| 80 | + $rules[] = "[['".implode("', '", $columns)."'], 'string', 'max' => $length]"; |
|
| 81 | 81 | } |
| 82 | 82 | $db = $this->getDbConnection(); |
| 83 | 83 | // Unique indexes rules |
@@ -88,12 +88,12 @@ discard block |
||
| 88 | 88 | if (!$this->isColumnAutoIncremental($table, $uniqueColumns)) { |
| 89 | 89 | $attributesCount = count($uniqueColumns); |
| 90 | 90 | if ($attributesCount === 1) { |
| 91 | - $rules[] = "[['" . $uniqueColumns[0] . "'], 'unique']"; |
|
| 91 | + $rules[] = "[['".$uniqueColumns[0]."'], 'unique']"; |
|
| 92 | 92 | } elseif ($attributesCount > 1) { |
| 93 | 93 | $labels = array_intersect_key($this->generateLabels($table), array_flip($uniqueColumns)); |
| 94 | 94 | $lastLabel = array_pop($labels); |
| 95 | 95 | $columnsList = implode("', '", $uniqueColumns); |
| 96 | - $rules[] = "[['$columnsList'], 'unique', 'targetAttribute' => ['$columnsList'], 'message' => 'The combination of " . implode(', ', $labels) . " and $lastLabel has already been taken.']"; |
|
| 96 | + $rules[] = "[['$columnsList'], 'unique', 'targetAttribute' => ['$columnsList'], 'message' => 'The combination of ".implode(', ', $labels)." and $lastLabel has already been taken.']"; |
|
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | } |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | $fullTableName = $tableName; |
| 137 | 137 | if (($pos = strrpos($tableName, '.')) !== false) { |
| 138 | 138 | if (($useSchemaName === null && $this->useSchemaName) || $useSchemaName) { |
| 139 | - $schemaName = substr($tableName, 0, $pos) . '_'; |
|
| 139 | + $schemaName = substr($tableName, 0, $pos).'_'; |
|
| 140 | 140 | } |
| 141 | 141 | $tableName = substr($tableName, $pos + 1); |
| 142 | 142 | } |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | if (($pos = strrpos($pattern, '.')) !== false) { |
| 150 | 150 | $pattern = substr($pattern, $pos + 1); |
| 151 | 151 | } |
| 152 | - $patterns[] = '/^' . str_replace('*', '(\w+)', $pattern) . '$/'; |
|
| 152 | + $patterns[] = '/^'.str_replace('*', '(\w+)', $pattern).'$/'; |
|
| 153 | 153 | } |
| 154 | 154 | $className = $tableName; |
| 155 | 155 | foreach ($patterns as $pattern) { |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | } else { |
| 194 | 194 | $label = Inflector::camel2words($column->name); |
| 195 | 195 | if (!empty($label) && substr_compare($label, ' id', -3, 3, true) === 0) { |
| 196 | - $label = substr($label, 0, -3) . ' ID'; |
|
| 196 | + $label = substr($label, 0, -3).' ID'; |
|
| 197 | 197 | } |
| 198 | 198 | $labels[$column->name] = $label; |
| 199 | 199 | } |