Completed
Pull Request — master (#2042)
by Marc
02:11
created
core/console/commands/ThemeController.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,6 @@
 block discarded – undo
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.
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
165 165
     }
166 166
     
167 167
     /**
168
-     * @param $themeName
168
+     * @param string $themeName
169 169
      *
170 170
      * @return string
171 171
      */
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 /**
Please login to merge, or discard this patch.
core/traits/ErrorHandlerTrait.php 2 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      *
68 68
      * @param string $message The message you want to send to the error api server.
69 69
      * @param string $file The you are currently send the message (use __FILE__)
70
-     * @param string $line The line you want to submit (use __LINE__)
70
+     * @param integer $line The line you want to submit (use __LINE__)
71 71
      * @return bool|null
72 72
      */
73 73
     public function transferMessage($message, $file = __FILE__, $line = __LINE__)
@@ -105,6 +105,7 @@  discard block
 block discarded – undo
105 105
     
106 106
     /**
107 107
      * @inheritdoc
108
+     * @param \Exception $exception
108 109
      */
109 110
     public function renderException($exception)
110 111
     {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -176,9 +176,9 @@  discard block
 block discarded – undo
176 176
             $_file = $exception->getFile();
177 177
             $_line = $exception->getLine();
178 178
         } elseif (is_string($exception)) {
179
-            $_message = 'exception string: ' . $exception;
179
+            $_message = 'exception string: '.$exception;
180 180
         } elseif (is_array($exception)) {
181
-            $_message = isset($exception['message']) ? $exception['message'] : 'exception array dump: ' . print_r($exception, true);
181
+            $_message = isset($exception['message']) ? $exception['message'] : 'exception array dump: '.print_r($exception, true);
182 182
             $_file = isset($exception['file']) ? $exception['file'] : __FILE__;
183 183
             $_line = isset($exception['line']) ? $exception['line'] : __LINE__;
184 184
         }
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 
250 250
         if (!empty($file)) {
251 251
             try {
252
-                $lineInArray = $line -1;
252
+                $lineInArray = $line - 1;
253 253
                 // load file from path
254 254
                 $fileInfo = file($file, FILE_IGNORE_NEW_LINES);
255 255
                 // load file if false from real path
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
             'class' => isset($item['class']) ? $item['class'] : null,
290 290
             // currently arguments wont be transmited due to large amount of informations based on base object
291 291
             //'args' => isset($item['args']) ? ArrayHelper::coverSensitiveValues($item['args'], $this->sensitiveKeys) : [],
292
-        ], function ($value) {
292
+        ], function($value) {
293 293
             return !empty($value);
294 294
         });
295 295
     }
Please login to merge, or discard this patch.
core/helpers/ExportHelper.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
     {
140 140
         $output = null;
141 141
         foreach ($input as $row) {
142
-            $output.= self::generateRow($row, $delimiter, '"');
142
+            $output .= self::generateRow($row, $delimiter, '"');
143 143
         }
144 144
 
145 145
         return $output;
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
      */
157 157
     protected static function generateRow(array $row, $delimiter, $enclose)
158 158
     {
159
-        array_walk($row, function (&$item) use ($enclose) {
159
+        array_walk($row, function(&$item) use ($enclose) {
160 160
             if (is_bool($item)) {
161 161
                 $item = (int) $item;
162 162
             } elseif (is_null($item)) {
@@ -171,6 +171,6 @@  discard block
 block discarded – undo
171 171
             ], $item).$enclose;
172 172
         });
173 173
 
174
-        return implode($delimiter, $row) . PHP_EOL;
174
+        return implode($delimiter, $row).PHP_EOL;
175 175
     }
176 176
 }
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      * @param array|QueryInterface $input
38 38
      * @param array $keys Defines which keys should be packed into the generated xlsx. The defined keys does not change the sort behavior of the generated xls.
39 39
      * @param bool $header
40
-     * @return mixed
40
+     * @return string
41 41
      * @throws Exception
42 42
      * @since 1.0.4
43 43
      */
@@ -73,7 +73,6 @@  discard block
 block discarded – undo
73 73
      * Generate content by rows.
74 74
      *
75 75
      * @param array $contentRows
76
-     * @param string $delimiter
77 76
      * @param array $keys
78 77
      * @param bool $generateHeader
79 78
      * @return array
Please login to merge, or discard this patch.
core/theme/Theme.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         }
75 75
     
76 76
         $pos = strpos($viewPath, '/');
77
-        $rootPath = $pos === false ? $viewPath : (substr($viewPath, 0, $pos) . '/views');
77
+        $rootPath = $pos === false ? $viewPath : (substr($viewPath, 0, $pos).'/views');
78 78
         $this->pathMap[$rootPath] = $pathMap;
79 79
     
80 80
         $this->pathMap['@app/views'] = $pathMap;
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      */
110 110
     public function getLayoutPath()
111 111
     {
112
-        return $this->viewPath . '/' . self::LAYOUTS_PATH;
112
+        return $this->viewPath.'/'.self::LAYOUTS_PATH;
113 113
     }
114 114
     
115 115
     /**
Please login to merge, or discard this patch.
core/web/filters/RobotsFilter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@
 block discarded – undo
123 123
     {
124 124
         if (Yii::$app->request->isPost) {
125 125
             if ($this->getElapsedProcessTime() < $this->delay) {
126
-                throw new WhitelistedException("Robots Filter has detected an invalid Request: " . VarDumper::export(ArrayHelper::coverSensitiveValues(Yii::$app->request->post())));
126
+                throw new WhitelistedException("Robots Filter has detected an invalid Request: ".VarDumper::export(ArrayHelper::coverSensitiveValues(Yii::$app->request->post())));
127 127
             }
128 128
         }
129 129
         
Please login to merge, or discard this patch.
core/theme/ThemeConfig.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -140,6 +140,6 @@
 block discarded – undo
140 140
      */
141 141
     public function getViewPath()
142 142
     {
143
-        return $this->getBasePath() . '/views';
143
+        return $this->getBasePath().'/views';
144 144
     }
145 145
 }
Please login to merge, or discard this patch.
core/helpers/ObjectHelper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         }
59 59
         
60 60
         if ($throwException) {
61
-            throw new Exception("The given object must be an instance of: " . implode(",", $haystack));
61
+            throw new Exception("The given object must be an instance of: ".implode(",", $haystack));
62 62
         }
63 63
         
64 64
         return false;
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
         } catch (InvalidParamException $e) {
228 228
         };
229 229
 
230
-        $staticPath = $module::staticBasePath() . DIRECTORY_SEPARATOR . 'controllers';
230
+        $staticPath = $module::staticBasePath().DIRECTORY_SEPARATOR.'controllers';
231 231
         if (is_dir($staticPath)) {
232 232
             foreach (FileHelper::findFiles($staticPath) as $file) {
233 233
                 $files[self::fileToName($staticPath, $file)] = $file;
Please login to merge, or discard this patch.
core/tag/tags/LinkTag.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
     {
58 58
         if (StringHelper::startsWith($value, '//')) {
59 59
             // its an absolute url
60
-            $value = StringHelper::replaceFirst('//', Url::base(true) . '/', $value);
60
+            $value = StringHelper::replaceFirst('//', Url::base(true).'/', $value);
61 61
             $external = false;
62 62
         } elseif (StringHelper::startsWith($value, '/')) {
63 63
             // its a relative url, keep it like this
Please login to merge, or discard this patch.
core/console/Command.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     {
41 41
         if ($this->verbose) {
42 42
             $message = $this->printableMessage($message);
43
-            $this->output(!empty($section) ? $section . ': ' . $message : $message);
43
+            $this->output(!empty($section) ? $section.': '.$message : $message);
44 44
         }
45 45
     }
46 46
     
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
             $name = substr($name, 0, -(strlen($suffix)));
119 119
         }
120 120
     
121
-        return $name . $suffix;
121
+        return $name.$suffix;
122 122
     }
123 123
     
124 124
     /**
Please login to merge, or discard this patch.