@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | $messageFiles = glob("$repoPath/src/**/messages/$language/$filename.php") ?: glob("$repoPath/src/messages/$language/$filename.php"); |
| 42 | 42 | |
| 43 | 43 | $this->outputInfo('Following files will be affected:'); |
| 44 | - $this->output(implode("\n", $messageFiles) . "\n"); |
|
| 44 | + $this->output(implode("\n", $messageFiles)."\n"); |
|
| 45 | 45 | |
| 46 | 46 | $key = $this->prompt('Insert translation key:'); |
| 47 | 47 | $text = $this->prompt('Insert translation text:'); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | if (!$this->dry) { |
| 61 | 61 | if (exec("[ -d $repoPath/.git ] && command -v git")) { |
| 62 | - $diffCommand = "git --git-dir=$repoPath/.git --work-tree=$repoPath diff -- " . str_replace($repoPath . '/', '', implode(" ", $messageFiles)); |
|
| 62 | + $diffCommand = "git --git-dir=$repoPath/.git --work-tree=$repoPath diff -- ".str_replace($repoPath.'/', '', implode(" ", $messageFiles)); |
|
| 63 | 63 | exec($diffCommand, $diff); |
| 64 | 64 | $this->output(implode("\n", $diff)); |
| 65 | 65 | } |
@@ -33,14 +33,14 @@ |
||
| 33 | 33 | { |
| 34 | 34 | if ($this->module instanceof Module) { |
| 35 | 35 | if ($this->module->useAppViewPath) { |
| 36 | - return '@app/views/' . $this->module->id . '/' . $this->id; |
|
| 36 | + return '@app/views/'.$this->module->id.'/'.$this->id; |
|
| 37 | 37 | } elseif (is_array($this->module->viewMap)) { |
| 38 | - $currentAction = $this->id . '/' . ($this->action ? $this->action->id : $this->defaultAction); |
|
| 38 | + $currentAction = $this->id.'/'.($this->action ? $this->action->id : $this->defaultAction); |
|
| 39 | 39 | foreach ($this->module->viewMap as $action => $viewPath) { |
| 40 | 40 | |
| 41 | 41 | // Special case for map all views of controller |
| 42 | 42 | if ($action === '*') { |
| 43 | - return $viewPath . '/' . $this->id; |
|
| 43 | + return $viewPath.'/'.$this->id; |
|
| 44 | 44 | } elseif (fnmatch($action, $currentAction)) { |
| 45 | 45 | return $viewPath; |
| 46 | 46 | } |
@@ -100,25 +100,25 @@ discard block |
||
| 100 | 100 | public function run() |
| 101 | 101 | { |
| 102 | 102 | // Cache generated code |
| 103 | - return $this->getOrSetHasCache(['svg', $this->folder, $this->file, $this->cssClass], function () { |
|
| 103 | + return $this->getOrSetHasCache(['svg', $this->folder, $this->file, $this->cssClass], function() { |
|
| 104 | 104 | |
| 105 | 105 | // Check if file ends with .svg, if not add the extension |
| 106 | - $svgFile = StringHelper::endsWith($this->file, '.svg') ? $this->file : $this->file . '.svg'; |
|
| 106 | + $svgFile = StringHelper::endsWith($this->file, '.svg') ? $this->file : $this->file.'.svg'; |
|
| 107 | 107 | |
| 108 | 108 | if ($this->symbolMode) { |
| 109 | - $svgPath = Yii::$app->view->publicHtml . '/' . $svgFile; |
|
| 109 | + $svgPath = Yii::$app->view->publicHtml.'/'.$svgFile; |
|
| 110 | 110 | |
| 111 | - return '<svg class="symbol symbol--' . $this->symbolName . '' . ($this->cssClass ? ' ' . $this->cssClass : '') . '"><use class="symbol__use" xlink:href="' . $svgPath . '#' . $this->symbolName . '" /></svg>'; |
|
| 111 | + return '<svg class="symbol symbol--'.$this->symbolName.''.($this->cssClass ? ' '.$this->cssClass : '').'"><use class="symbol__use" xlink:href="'.$svgPath.'#'.$this->symbolName.'" /></svg>'; |
|
| 112 | 112 | } else { |
| 113 | 113 | // Build the full svg file path |
| 114 | - $svgPath = $this->folder . DIRECTORY_SEPARATOR . $svgFile; |
|
| 114 | + $svgPath = $this->folder.DIRECTORY_SEPARATOR.$svgFile; |
|
| 115 | 115 | |
| 116 | 116 | // Get the svg contents |
| 117 | 117 | $content = FileHelper::getFileContent($svgPath); |
| 118 | 118 | |
| 119 | 119 | // If a cssClass string is given, add it to the <svg> tag |
| 120 | 120 | if ($this->cssClass && is_string($this->cssClass)) { |
| 121 | - $content = preg_replace('/<svg/', '<svg class="' . $this->cssClass . '"', $content); |
|
| 121 | + $content = preg_replace('/<svg/', '<svg class="'.$this->cssClass.'"', $content); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | if ($content) { |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - throw new Exception('Unable to access SVG File: ' . $svgPath); |
|
| 129 | + throw new Exception('Unable to access SVG File: '.$svgPath); |
|
| 130 | 130 | }); |
| 131 | 131 | } |
| 132 | 132 | } |
@@ -255,6 +255,6 @@ |
||
| 255 | 255 | { |
| 256 | 256 | $view = new View(); |
| 257 | 257 | $view->autoRegisterCsrf = false; |
| 258 | - return $view->renderPhpFile(rtrim($this->getFolder(), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . FileHelper::ensureExtension($file, 'php'), $args); |
|
| 258 | + return $view->renderPhpFile(rtrim($this->getFolder(), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.FileHelper::ensureExtension($file, 'php'), $args); |
|
| 259 | 259 | } |
| 260 | 260 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | return true; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - return ($value == (string)(float) $value); |
|
| 99 | + return ($value == (string) (float) $value); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | // we could not find any match, therefore use casual truncate method. |
| 206 | 206 | if ($first === false) { |
| 207 | 207 | // as the length value in truncate middle stands for to the left and to the right, we multiple this value with 2 |
| 208 | - return self::truncate($content, ($length*2), $affix); |
|
| 208 | + return self::truncate($content, ($length * 2), $affix); |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | $last = $first + mb_strlen($word); |
@@ -217,9 +217,9 @@ discard block |
||
| 217 | 217 | |
| 218 | 218 | // string before |
| 219 | 219 | $before = (count($left) > $length) ? $affix.implode("", array_slice($left, -$length)) : implode("", $left); |
| 220 | - $after = (count($right) > $length) ? implode("", array_slice($right, 0, $length)) . $affix : implode("", $right); |
|
| 220 | + $after = (count($right) > $length) ? implode("", array_slice($right, 0, $length)).$affix : implode("", $right); |
|
| 221 | 221 | |
| 222 | - return $before . implode("", $middle) . $after; |
|
| 222 | + return $before.implode("", $middle).$after; |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | /** |
@@ -89,7 +89,6 @@ discard block |
||
| 89 | 89 | * ``` |
| 90 | 90 | * |
| 91 | 91 | * @param $value The value on which the filter conditions should be applied on. |
| 92 | - * @param array|string $filters An array of filter conditions, if a string is given he will be exploded by commas. |
|
| 93 | 92 | * @param boolean $caseSensitive Whether to match value even when lower/upper case is not correct/same. |
| 94 | 93 | * @return bool Returns true if one of the given filter conditions matches. |
| 95 | 94 | * @since 1.3.0 |
@@ -170,7 +169,7 @@ discard block |
||
| 170 | 169 | * @param string $search Search string to look for. |
| 171 | 170 | * @param string $replace Replacement value for the first found occurrence. |
| 172 | 171 | * @param string $subject The string you want to look up to replace the first element. |
| 173 | - * @return mixed Replaced string |
|
| 172 | + * @return string Replaced string |
|
| 174 | 173 | */ |
| 175 | 174 | public static function replaceFirst($search, $replace, $subject) |
| 176 | 175 | { |
@@ -200,7 +199,7 @@ discard block |
||
| 200 | 199 | * } |
| 201 | 200 | * ``` |
| 202 | 201 | * |
| 203 | - * @param string|array $needle The char or word to find in the $haystack. Can be an array to multi find words or char in the string. |
|
| 202 | + * @param string $needle The char or word to find in the $haystack. Can be an array to multi find words or char in the string. |
|
| 204 | 203 | * @param string $haystack The haystack where the $needle string should be looked up. A string or phrase with words. |
| 205 | 204 | * @param boolean $strict If an array of needles is provided the $strict parameter defines whether all keys must be found ($strict = true) or just one result must be found ($strict = false). |
| 206 | 205 | * @return boolean If an array of values is provided the response may change depending on $findAll. |
@@ -237,7 +236,7 @@ discard block |
||
| 237 | 236 | * @param string $content The content to minify. |
| 238 | 237 | * @param array $options Optional arguments to provide for minification: |
| 239 | 238 | * - comments: boolean, where html comments should be removed or not. defaults to false |
| 240 | - * @return mixed Returns the minified content. |
|
| 239 | + * @return string Returns the minified content. |
|
| 241 | 240 | * @since 1.0.7 |
| 242 | 241 | */ |
| 243 | 242 | public static function minify($content, array $options = []) |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | /** |
| 170 | 170 | * The time admission will commence. |
| 171 | 171 | * |
| 172 | - * @param DateTime $doorTime |
|
| 172 | + * @param DateTimeValue $doorTime |
|
| 173 | 173 | * @return static |
| 174 | 174 | */ |
| 175 | 175 | public function setDoorTime(DateTimeValue $doorTime) |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | /** |
| 192 | 192 | * The duration of the item (movie, audio recording, event, etc.) in ISO 8601 date format. |
| 193 | 193 | * |
| 194 | - * @param Duration $duration |
|
| 194 | + * @param DurationValue $duration |
|
| 195 | 195 | * @return static |
| 196 | 196 | */ |
| 197 | 197 | public function setDuration(DurationValue $duration) |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | /** |
| 214 | 214 | * The end date and time of the item (in ISO 8601 date format). |
| 215 | 215 | * |
| 216 | - * @param Date|DateTime $endDate |
|
| 216 | + * @param DateTimeValue $endDate |
|
| 217 | 217 | * @return static |
| 218 | 218 | */ |
| 219 | 219 | public function setEndDate(DateTimeValue $endDate) |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | * Please use one of the language codes from the IETF BCP 47 standard. See also availableLanguage. |
| 262 | 262 | * Supersedes language. |
| 263 | 263 | * |
| 264 | - * @param Language|Text $inLanguage |
|
| 264 | + * @param LanguageValue $inLanguage |
|
| 265 | 265 | * @return static |
| 266 | 266 | */ |
| 267 | 267 | public function setInLanguage(LanguageValue $inLanguage) |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | |
| 217 | 217 | return [ |
| 218 | 218 | 'module' => $this->module->id, |
| 219 | - 'route' => $this->module->id . '/' . $request['route'], |
|
| 219 | + 'route' => $this->module->id.'/'.$request['route'], |
|
| 220 | 220 | 'params' => $request['originalArgs'], |
| 221 | 221 | ]; |
| 222 | 222 | } |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | throw new NotFoundHttpException(sprintf("Unable to create controller '%s' for module '%s'.", $requestRoute['route'], $this->module->id)); |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | - Yii::debug('LUYA module run module "'.$this->module->id.'" route ' . $requestRoute['route'], __METHOD__); |
|
| 240 | + Yii::debug('LUYA module run module "'.$this->module->id.'" route '.$requestRoute['route'], __METHOD__); |
|
| 241 | 241 | |
| 242 | 242 | $this->controller = $controller[0]; |
| 243 | 243 | $originalController = Yii::$app->controller; |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | * |
| 249 | 249 | * @see https://github.com/luyadev/luya/issues/1730 |
| 250 | 250 | */ |
| 251 | - $this->controller->on(Controller::EVENT_BEFORE_ACTION, function ($event) { |
|
| 251 | + $this->controller->on(Controller::EVENT_BEFORE_ACTION, function($event) { |
|
| 252 | 252 | Yii::$app->controller = $this->controller; |
| 253 | 253 | }); |
| 254 | 254 | /** |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | * |
| 257 | 257 | * @see https://github.com/luyadev/luya/issues/1768 |
| 258 | 258 | */ |
| 259 | - $this->controller->on(Controller::EVENT_AFTER_ACTION, function ($event) use ($originalController) { |
|
| 259 | + $this->controller->on(Controller::EVENT_AFTER_ACTION, function($event) use ($originalController) { |
|
| 260 | 260 | Yii::$app->controller = $originalController; |
| 261 | 261 | }); |
| 262 | 262 | |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | /** |
| 50 | 50 | * Getter method for the e-mail. |
| 51 | 51 | * |
| 52 | - * @return string|boolean Returns the e-mail from the setter method, if mail is not valid false is returned. |
|
| 52 | + * @return string|false Returns the e-mail from the setter method, if mail is not valid false is returned. |
|
| 53 | 53 | */ |
| 54 | 54 | public function getEmail() |
| 55 | 55 | { |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | */ |
| 62 | 62 | public function getHref() |
| 63 | 63 | { |
| 64 | - return empty($this->getEmail()) ? null : 'mailto:' . $this->getEmail(); |
|
| 64 | + return empty($this->getEmail()) ? null : 'mailto:'.$this->getEmail(); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
@@ -7,7 +7,6 @@ |
||
| 7 | 7 | use luya\theme\ThemeConfig; |
| 8 | 8 | use Yii; |
| 9 | 9 | use yii\helpers\Console; |
| 10 | -use yii\helpers\Inflector; |
|
| 11 | 10 | |
| 12 | 11 | /** |
| 13 | 12 | * Command to create a new LUYA theme. |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | /** |
| 147 | - * @param $themeName |
|
| 147 | + * @param string $themeName |
|
| 148 | 148 | * |
| 149 | 149 | * @return string |
| 150 | 150 | */ |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | /** |
| 168 | - * @param $themeName |
|
| 168 | + * @param string $themeName |
|
| 169 | 169 | * |
| 170 | 170 | * @return string |
| 171 | 171 | */ |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | $availableModules = implode(', ', array_column(Yii::$app->getFrontendModules(), 'id')); |
| 49 | 49 | $themeLocation = $this->prompt("Enter the theme location where to generate (as path alias e.g. app, $availableModules):", ['default' => 'app']); |
| 50 | - $themeLocation = '@' . ltrim($themeLocation, '@'); |
|
| 50 | + $themeLocation = '@'.ltrim($themeLocation, '@'); |
|
| 51 | 51 | |
| 52 | 52 | preg_match("#^@[A-z]+#", $themeLocation, $newThemeLocation); |
| 53 | 53 | |
@@ -59,15 +59,15 @@ discard block |
||
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - $basePath = $themeLocation . '/themes/' . $themeName; |
|
| 62 | + $basePath = $themeLocation.'/themes/'.$themeName; |
|
| 63 | 63 | $themeFolder = Yii::getAlias($basePath); |
| 64 | 64 | |
| 65 | 65 | if (file_exists($themeFolder)) { |
| 66 | - return $this->outputError("The folder " . $themeFolder . " exists already."); |
|
| 66 | + return $this->outputError("The folder ".$themeFolder." exists already."); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - $this->outputInfo("Theme path alias: " . $basePath); |
|
| 70 | - $this->outputInfo("Theme real path: " . $themeFolder); |
|
| 69 | + $this->outputInfo("Theme path alias: ".$basePath); |
|
| 70 | + $this->outputInfo("Theme real path: ".$themeFolder); |
|
| 71 | 71 | if (!$this->confirm("Do you want continue?")) { |
| 72 | 72 | return $this->outputError('Abort by user.'); |
| 73 | 73 | } |
@@ -81,15 +81,15 @@ discard block |
||
| 81 | 81 | ]; |
| 82 | 82 | |
| 83 | 83 | foreach ($folders as $folder) { |
| 84 | - FileHelper::createDirectory($themeFolder . DIRECTORY_SEPARATOR . $folder); |
|
| 84 | + FileHelper::createDirectory($themeFolder.DIRECTORY_SEPARATOR.$folder); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | $contents = [ |
| 88 | - $themeFolder. DIRECTORY_SEPARATOR . 'theme.json' => $this->renderJson($basePath, $themeName), |
|
| 89 | - $themeFolder. DIRECTORY_SEPARATOR . ucfirst($themeName) . 'Asset.php' => $this->renderAssetClass($themeName), |
|
| 90 | - $themeFolder. DIRECTORY_SEPARATOR . 'resources/'. $themeName .'.css' => '', |
|
| 91 | - $themeFolder. DIRECTORY_SEPARATOR . 'views/layouts/theme.php' => $this->renderLayout($themeName), |
|
| 92 | - $themeFolder. DIRECTORY_SEPARATOR . 'views/cmslayouts/theme.php' => $this->renderCmsLayout($themeName), |
|
| 88 | + $themeFolder.DIRECTORY_SEPARATOR.'theme.json' => $this->renderJson($basePath, $themeName), |
|
| 89 | + $themeFolder.DIRECTORY_SEPARATOR.ucfirst($themeName).'Asset.php' => $this->renderAssetClass($themeName), |
|
| 90 | + $themeFolder.DIRECTORY_SEPARATOR.'resources/'.$themeName.'.css' => '', |
|
| 91 | + $themeFolder.DIRECTORY_SEPARATOR.'views/layouts/theme.php' => $this->renderLayout($themeName), |
|
| 92 | + $themeFolder.DIRECTORY_SEPARATOR.'views/cmslayouts/theme.php' => $this->renderCmsLayout($themeName), |
|
| 93 | 93 | ]; |
| 94 | 94 | |
| 95 | 95 | foreach ($contents as $fileName => $content) { |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | private function renderAssetClass($themeName) |
| 152 | 152 | { |
| 153 | - $className = ucfirst($themeName) . 'Asset'; |
|
| 153 | + $className = ucfirst($themeName).'Asset'; |
|
| 154 | 154 | return "<?php |
| 155 | 155 | namespace app\\themes\\{$themeName}; |
| 156 | 156 | |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | private function renderLayout($themeName) |
| 173 | 173 | { |
| 174 | - $className = ucfirst($themeName) . 'Asset'; |
|
| 174 | + $className = ucfirst($themeName).'Asset'; |
|
| 175 | 175 | |
| 176 | 176 | return '<?php |
| 177 | 177 | /** |