@@ -29,7 +29,7 @@ |
||
29 | 29 | |
30 | 30 | if ($this->sourcePath === null) { |
31 | 31 | $class = new ReflectionClass($this); |
32 | - $this->sourcePath = dirname($class->getFileName()) . DIRECTORY_SEPARATOR . $this->defaultSourcePathFolder . DIRECTORY_SEPARATOR . Inflector::camel2id($class->getShortName()); |
|
32 | + $this->sourcePath = dirname($class->getFileName()).DIRECTORY_SEPARATOR.$this->defaultSourcePathFolder.DIRECTORY_SEPARATOR.Inflector::camel2id($class->getShortName()); |
|
33 | 33 | } |
34 | 34 | } |
35 | 35 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $dir = $basePath; |
56 | 56 | } else { |
57 | 57 | // relative path |
58 | - throw new InvalidConfigException('Theme base path have to be absolute or alias: ' . $basePath); |
|
58 | + throw new InvalidConfigException('Theme base path have to be absolute or alias: '.$basePath); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | // $basePath is an absolute path = /VENDOR/NAME/theme.json |
@@ -65,12 +65,12 @@ discard block |
||
65 | 65 | $basePath = pathinfo($basePath, PATHINFO_DIRNAME); |
66 | 66 | } else { |
67 | 67 | if (!is_dir($dir) || !is_readable($dir)) { |
68 | - throw new Exception('Theme directory not exists or readable: ' . $dir); |
|
68 | + throw new Exception('Theme directory not exists or readable: '.$dir); |
|
69 | 69 | } |
70 | 70 | |
71 | - $themeFile = $dir . DIRECTORY_SEPARATOR . 'theme.json'; |
|
71 | + $themeFile = $dir.DIRECTORY_SEPARATOR.'theme.json'; |
|
72 | 72 | if (!file_exists($themeFile)) { |
73 | - throw new InvalidConfigException('Theme config file missing at: ' . $themeFile); |
|
73 | + throw new InvalidConfigException('Theme config file missing at: '.$themeFile); |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | |
173 | 173 | if (file_exists(Yii::getAlias('@app/themes'))) { |
174 | 174 | foreach (glob(Yii::getAlias('@app/themes/*')) as $dirPath) { |
175 | - $themeDefinitions[] = "@app/themes/" . basename($dirPath); |
|
175 | + $themeDefinitions[] = "@app/themes/".basename($dirPath); |
|
176 | 176 | } |
177 | 177 | } |
178 | 178 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | |
227 | 227 | $this->_themes[$basePath] = $themeConfig; |
228 | 228 | |
229 | - Yii::setAlias('@' . basename($basePath) . 'Theme', $basePath); |
|
229 | + Yii::setAlias('@'.basename($basePath).'Theme', $basePath); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | /** |
@@ -184,18 +184,18 @@ discard block |
||
184 | 184 | public function run() |
185 | 185 | { |
186 | 186 | if ($this->placeholderSrc && $this->placeholderAsBase64) { |
187 | - $this->placeholderSrc = 'data:image/jpg;base64,' . base64_encode(file_get_contents($this->placeholderSrc)); |
|
187 | + $this->placeholderSrc = 'data:image/jpg;base64,'.base64_encode(file_get_contents($this->placeholderSrc)); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | if ($this->attributesOnly && !$this->placeholderSrc) { |
191 | 191 | return "class=\"js-lazyimage $this->extraClass\" data-src=\"$this->src\" data-width=\"$this->width\" data-height=\"$this->height\" data-as-background=\"1\""; |
192 | 192 | } |
193 | 193 | |
194 | - $tag = '<div class="lazyimage-wrapper ' . $this->extraClass . '">'; |
|
194 | + $tag = '<div class="lazyimage-wrapper '.$this->extraClass.'">'; |
|
195 | 195 | $tag .= Html::tag('img', '', array_merge( |
196 | 196 | $this->options, |
197 | 197 | [ |
198 | - 'class' => 'js-lazyimage lazyimage' . ($this->replacePlaceholder ? (' ' . $this->extraClass) : ''), |
|
198 | + 'class' => 'js-lazyimage lazyimage'.($this->replacePlaceholder ? (' '.$this->extraClass) : ''), |
|
199 | 199 | 'data-src' => $this->src, |
200 | 200 | 'data-width' => $this->width, |
201 | 201 | 'data-height' => $this->height, |
@@ -205,9 +205,9 @@ discard block |
||
205 | 205 | if ($this->placeholderSrc) { |
206 | 206 | $tag .= Html::tag('img', '', ['class' => 'lazyimage-placeholder', 'src' => $this->placeholderSrc]); |
207 | 207 | } else { |
208 | - $tag .= '<div class="lazyimage-placeholder"><div style="display: block; height: 0px; padding-bottom: ' . $this->generateAspectRation() . '%;"></div><div class="loader"></div></div>'; |
|
208 | + $tag .= '<div class="lazyimage-placeholder"><div style="display: block; height: 0px; padding-bottom: '.$this->generateAspectRation().'%;"></div><div class="loader"></div></div>'; |
|
209 | 209 | } |
210 | - $tag .= '<noscript><img class="loaded ' . $this->extraClass . '" src="'.$this->src.'" /></noscript>'; |
|
210 | + $tag .= '<noscript><img class="loaded '.$this->extraClass.'" src="'.$this->src.'" /></noscript>'; |
|
211 | 211 | $tag .= '</div>'; |
212 | 212 | |
213 | 213 | return $tag; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public function prependCruft($content) |
66 | 66 | { |
67 | - return $this->cruft . trim($content); |
|
67 | + return $this->cruft.trim($content); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | { |
75 | 75 | if (Yii::$app->response->format == Response::FORMAT_JSON && !in_array(Yii::$app->response->statusCode, $this->ignoreStatusCodes)) { |
76 | 76 | Yii::$app->response->headers->set(self::CRUFT_HEADER_NAME, $this->getCruftLength()); |
77 | - Yii::$app->response->on(Response::EVENT_AFTER_PREPARE, function ($event) { |
|
77 | + Yii::$app->response->on(Response::EVENT_AFTER_PREPARE, function($event) { |
|
78 | 78 | $event->sender->content = $this->prependCruft($event->sender->content); |
79 | 79 | }); |
80 | 80 | } |
@@ -106,7 +106,7 @@ |
||
106 | 106 | // see if the module has a registerComponents method |
107 | 107 | foreach ($module->registerComponents() as $componentId => $definition) { |
108 | 108 | if (!$app->has($componentId)) { |
109 | - Yii::debug('Register component ' . $componentId, __METHOD__); |
|
109 | + Yii::debug('Register component '.$componentId, __METHOD__); |
|
110 | 110 | $app->set($componentId, $definition); |
111 | 111 | } |
112 | 112 | } |
@@ -48,7 +48,7 @@ |
||
48 | 48 | public function setHref($href) |
49 | 49 | { |
50 | 50 | if (StringHelper::startsWith($href, '//')) { |
51 | - $this->_href = Url::base(true) . str_replace('//', '/', $href); |
|
51 | + $this->_href = Url::base(true).str_replace('//', '/', $href); |
|
52 | 52 | } elseif (StringHelper::startsWith($href, '#')) { |
53 | 53 | // When an anchor link is given, do not modify the link. This can be usefull for one pagers |
54 | 54 | $this->_href = $href; |
@@ -102,25 +102,25 @@ discard block |
||
102 | 102 | public function run() |
103 | 103 | { |
104 | 104 | // Cache generated code |
105 | - return $this->getOrSetHasCache(['svg', $this->folder, $this->file, $this->cssClass, $this->symbolName], function () { |
|
105 | + return $this->getOrSetHasCache(['svg', $this->folder, $this->file, $this->cssClass, $this->symbolName], function() { |
|
106 | 106 | |
107 | 107 | // Check if file ends with .svg, if not add the extension |
108 | - $svgFile = StringHelper::endsWith($this->file, '.svg') ? $this->file : $this->file . '.svg'; |
|
108 | + $svgFile = StringHelper::endsWith($this->file, '.svg') ? $this->file : $this->file.'.svg'; |
|
109 | 109 | |
110 | 110 | if ($this->symbolMode) { |
111 | - $svgPath = Yii::$app->view->publicHtml . '/' . $svgFile; |
|
111 | + $svgPath = Yii::$app->view->publicHtml.'/'.$svgFile; |
|
112 | 112 | |
113 | - return '<svg class="symbol symbol--' . $this->symbolName . '' . ($this->cssClass ? ' ' . $this->cssClass : '') . '"><use class="symbol__use" xlink:href="' . $svgPath . '#' . $this->symbolName . '" /></svg>'; |
|
113 | + return '<svg class="symbol symbol--'.$this->symbolName.''.($this->cssClass ? ' '.$this->cssClass : '').'"><use class="symbol__use" xlink:href="'.$svgPath.'#'.$this->symbolName.'" /></svg>'; |
|
114 | 114 | } else { |
115 | 115 | // Build the full svg file path |
116 | - $svgPath = $this->folder . DIRECTORY_SEPARATOR . $svgFile; |
|
116 | + $svgPath = $this->folder.DIRECTORY_SEPARATOR.$svgFile; |
|
117 | 117 | |
118 | 118 | // Get the svg contents |
119 | 119 | $content = FileHelper::getFileContent($svgPath); |
120 | 120 | |
121 | 121 | // If a cssClass string is given, add it to the <svg> tag |
122 | 122 | if ($this->cssClass && is_string($this->cssClass)) { |
123 | - $content = preg_replace('/<svg/', '<svg class="' . $this->cssClass . '"', $content); |
|
123 | + $content = preg_replace('/<svg/', '<svg class="'.$this->cssClass.'"', $content); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | if ($content) { |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
131 | - throw new Exception('Unable to access SVG File: ' . $svgPath); |
|
131 | + throw new Exception('Unable to access SVG File: '.$svgPath); |
|
132 | 132 | }); |
133 | 133 | } |
134 | 134 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $this->_mailer->isSMTP(); |
143 | 143 | $this->_mailer->SMTPSecure = $this->smtpSecure; |
144 | 144 | $this->_mailer->Host = (string) $this->host; |
145 | - $this->_mailer->SMTPAuth= $this->smtpAuth; |
|
145 | + $this->_mailer->SMTPAuth = $this->smtpAuth; |
|
146 | 146 | $this->_mailer->Username = $this->username; |
147 | 147 | $this->_mailer->Password = $this->password; |
148 | 148 | $this->_mailer->Port = $this->port; |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | return true; |
503 | 503 | } else { |
504 | 504 | $data = [$this->host, $this->port, $this->smtpSecure, $this->username]; |
505 | - throw new Exception('Authentication failed ('.implode(',', $data).'): '.$smtp->getLastReply() . PHP_EOL . print_r($smtp->getError(), true)); |
|
505 | + throw new Exception('Authentication failed ('.implode(',', $data).'): '.$smtp->getLastReply().PHP_EOL.print_r($smtp->getError(), true)); |
|
506 | 506 | } |
507 | 507 | } else { |
508 | 508 | throw new Exception('HELO failed: '.$smtp->getLastReply()); |
@@ -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 . DIRECTORY_SEPARATOR . 'themes' . DIRECTORY_SEPARATOR . $themeName; |
|
63 | - $themeFolder = Yii::getAlias($themeLocation) . DIRECTORY_SEPARATOR . 'themes' . DIRECTORY_SEPARATOR . $themeName; |
|
62 | + $basePath = $themeLocation.DIRECTORY_SEPARATOR.'themes'.DIRECTORY_SEPARATOR.$themeName; |
|
63 | + $themeFolder = Yii::getAlias($themeLocation).DIRECTORY_SEPARATOR.'themes'.DIRECTORY_SEPARATOR.$themeName; |
|
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'.DIRECTORY_SEPARATOR. $themeName .'.css' => '', |
|
91 | - $themeFolder. DIRECTORY_SEPARATOR . 'views'.DIRECTORY_SEPARATOR.'layouts'.DIRECTORY_SEPARATOR.'theme.php' => $this->renderLayout($themeName), |
|
92 | - $themeFolder. DIRECTORY_SEPARATOR . 'views'.DIRECTORY_SEPARATOR.'cmslayouts'.DIRECTORY_SEPARATOR.'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'.DIRECTORY_SEPARATOR.$themeName.'.css' => '', |
|
91 | + $themeFolder.DIRECTORY_SEPARATOR.'views'.DIRECTORY_SEPARATOR.'layouts'.DIRECTORY_SEPARATOR.'theme.php' => $this->renderLayout($themeName), |
|
92 | + $themeFolder.DIRECTORY_SEPARATOR.'views'.DIRECTORY_SEPARATOR.'cmslayouts'.DIRECTORY_SEPARATOR.'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 | /** |