Completed
Push — master ( fbc8fa...2cac0a )
by Andrii
03:56
created
src/base/File.php 2 patches
Doc Comments   +13 added lines, -1 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 
89 89
     /**
90 90
      * Create file object.
91
-     * @param string|array $path or config
91
+     * @param string $path or config
92 92
      * @return File
93 93
      */
94 94
     public static function create($path)
@@ -144,6 +144,9 @@  discard block
 block discarded – undo
144 144
         return $type2extension[$type];
145 145
     }
146 146
 
147
+    /**
148
+     * @param string $extension
149
+     */
147 150
     public function getTypeByExtension($extension)
148 151
     {
149 152
         return isset(static::$_extension2type[$extension]) ? static::$_extension2type[$extension] : null;
@@ -158,6 +161,9 @@  discard block
 block discarded – undo
158 161
         return ($this->goal ? $this->goal->fileType : null) ?: static::getTypeByExtension($this->_extension) ?: 'template';
159 162
     }
160 163
 
164
+    /**
165
+     * @param string $path
166
+     */
161 167
     public function setPath($path)
162 168
     {
163 169
         $path             = Yii::getAlias($path);
@@ -234,6 +240,9 @@  discard block
 block discarded – undo
234 240
         return $this->getHandler()->renderPath($this->getPath(), $this->data);
235 241
     }
236 242
 
243
+    /**
244
+     * @param string $content
245
+     */
237 246
     public function write($content)
238 247
     {
239 248
         return $this->getHandler()->write($this->getPath(), $content);
@@ -244,6 +253,9 @@  discard block
 block discarded – undo
244 253
         return $this->data = $this->getHandler()->parsePath($this->getPath(), $this->getMinimalPath());
245 254
     }
246 255
 
256
+    /**
257
+     * @return string
258
+     */
247 259
     public function read()
248 260
     {
249 261
         return $this->getHandler()->read($this->getPath());
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
      */
124 124
     protected static $_extension2type = [
125 125
         'json'      => 'json',
126
-        'yml'       => 'yaml',  /// first one is preferred
126
+        'yml'       => 'yaml', /// first one is preferred
127 127
         'yaml'      => 'yaml',
128 128
         'xml'       => 'xml',
129 129
         'xml.dist'  => 'xml',
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
     {
175 175
         $path = $this->getPath();
176 176
         if (strncmp($path, '/', 1)) {
177
-            $path = getcwd() . '/' . $path;
177
+            $path = getcwd().'/'.$path;
178 178
         }
179 179
 
180 180
         return $path;
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 
188 188
     public function setBasename($basename)
189 189
     {
190
-        $this->setPath($this->_dirname . '/' . $basename);
190
+        $this->setPath($this->_dirname.'/'.$basename);
191 191
     }
192 192
 
193 193
     public function getBasename()
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 
198 198
     public function setDirname($dirname)
199 199
     {
200
-        $this->setPath($dirname . '/' . $this->_basename);
200
+        $this->setPath($dirname.'/'.$this->_basename);
201 201
     }
202 202
 
203 203
     public function getDirname()
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 
208 208
     public function setFilename($filename)
209 209
     {
210
-        $this->setPath($this->_dirname . '/' . $filename . '.' . $this->_extension);
210
+        $this->setPath($this->_dirname.'/'.$filename.'.'.$this->_extension);
211 211
     }
212 212
 
213 213
     public function getFilename()
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 
218 218
     public function setExtension($extension)
219 219
     {
220
-        $this->setPath($this->_dirname . '/' . $this->_filename . '.' . $extension);
220
+        $this->setPath($this->_dirname.'/'.$this->_filename.'.'.$extension);
221 221
     }
222 222
 
223 223
     public function getExtension()
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
     {
269 269
         if (!is_object($this->_handler)) {
270 270
             $this->_handler = Yii::createObject([
271
-                'class'    => 'hidev\handlers\\' . $this->getCtype() . 'Handler',
271
+                'class'    => 'hidev\handlers\\'.$this->getCtype().'Handler',
272 272
                 'template' => $this->template,
273 273
                 'goal'     => $this->goal,
274 274
             ]);
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 
372 372
     public function chown($value)
373 373
     {
374
-        $ownergroup = $this->getOwner() . ':' . $this->getGroup();
374
+        $ownergroup = $this->getOwner().':'.$this->getGroup();
375 375
         if (in_array((string) $value, [$ownergroup, $this->getOwner(), $this->getUid()], true)) {
376 376
             return;
377 377
         }
Please login to merge, or discard this patch.
src/helpers/FileHelper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
         }
33 33
 
34 34
         $level = $die ? Logger::LEVEL_ERROR : Logger::LEVEL_WARNING;
35
-        Yii::getLogger()->log('Failed to read file: ' . $path, $level, 'file');
35
+        Yii::getLogger()->log('Failed to read file: '.$path, $level, 'file');
36 36
 
37 37
         return false;
38 38
     }
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
                 unlink($tmp);
65 65
             }
66 66
         }
67
-        Yii::warning('Written file: ' . $path, 'file');
67
+        Yii::warning('Written file: '.$path, 'file');
68 68
 
69 69
         return true;
70 70
     }
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
         $path = rtrim(trim($path), '/');
82 82
         if (!file_exists($path)) {
83 83
             mkdir($path, 0777, true);
84
-            Yii::warning('Created dir:  ' . $path . '/', 'file');
84
+            Yii::warning('Created dir:  '.$path.'/', 'file');
85 85
 
86 86
             return true;
87 87
         }
Please login to merge, or discard this patch.
src/base/Module.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,6 +35,6 @@
 block discarded – undo
35 35
     {
36 36
         $ref = new ReflectionClass($this);
37 37
 
38
-        return dirname($ref->getFileName()) . '/views';
38
+        return dirname($ref->getFileName()).'/views';
39 39
     }
40 40
 }
Please login to merge, or discard this patch.
src/base/Component.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,6 +34,6 @@
 block discarded – undo
34 34
     {
35 35
         $ref = new ReflectionClass($this);
36 36
 
37
-        return dirname(dirname($ref->getFileName())) . '/views';
37
+        return dirname(dirname($ref->getFileName())).'/views';
38 38
     }
39 39
 }
Please login to merge, or discard this patch.
src/components/Vendor.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
 
33 33
     public function getTitleAndHomepage()
34 34
     {
35
-        return $this->title . ($this->homepage ? ' (' . $this->homepage . ')' : '');
35
+        return $this->title.($this->homepage ? ' ('.$this->homepage.')' : '');
36 36
     }
37 37
 
38 38
     public function getDescription()
Please login to merge, or discard this patch.
src/components/Package.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
         $cur = (int) date('Y');
43 43
         $old = (int) $this->year;
44 44
 
45
-        return ($old && $old < $cur ? $this->year . '-' : '') . $cur;
45
+        return ($old && $old < $cur ? $this->year.'-' : '').$cur;
46 46
     }
47 47
 
48 48
     public function getYear()
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
 
58 58
     public function getIssues()
59 59
     {
60
-        return $this->getItem('issues') ?: ($this->source . '/issues');
60
+        return $this->getItem('issues') ?: ($this->source.'/issues');
61 61
     }
62 62
 
63 63
     public function getWiki()
64 64
     {
65
-        return $this->getItem('wiki') ?: ($this->source . '/wiki');
65
+        return $this->getItem('wiki') ?: ($this->source.'/wiki');
66 66
     }
67 67
 
68 68
     public function getKeywords()
@@ -72,12 +72,12 @@  discard block
 block discarded – undo
72 72
 
73 73
     public function getFullName()
74 74
     {
75
-        return $this->getItem('fullName') ?: ($this->take('vendor')->name . '/' . $this->name);
75
+        return $this->getItem('fullName') ?: ($this->take('vendor')->name.'/'.$this->name);
76 76
     }
77 77
 
78 78
     public function getSource()
79 79
     {
80
-        return $this->getItem('source') ?: ('https://github.com/' . $this->take('github')->full_name);
80
+        return $this->getItem('source') ?: ('https://github.com/'.$this->take('github')->full_name);
81 81
     }
82 82
 
83 83
     public function getVersion()
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
     public static function defaultNamespace($vendor, $package)
94 94
     {
95
-        return preg_replace('/[^a-zA-Z0-9\\\\]+/', '', $vendor . strtr("-$package", '-', '\\'));
95
+        return preg_replace('/[^a-zA-Z0-9\\\\]+/', '', $vendor.strtr("-$package", '-', '\\'));
96 96
     }
97 97
 
98 98
     public function getSrc()
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 
105 105
     public function getHomepage()
106 106
     {
107
-        return $this->getItem('homepage') ?: ($this->isDomain() ? 'http://' . $this->name . '/' : $this->getSource());
107
+        return $this->getItem('homepage') ?: ($this->isDomain() ? 'http://'.$this->name.'/' : $this->getSource());
108 108
     }
109 109
 
110 110
     public function getForum()
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 
140 140
     public function getRepositoryUrl($file)
141 141
     {
142
-        return 'https://github.com/' . $this->getFullName() . '/blob/master/' . $file;
142
+        return 'https://github.com/'.$this->getFullName().'/blob/master/'.$file;
143 143
     }
144 144
 
145 145
     public function getAuthors()
Please login to merge, or discard this patch.
src/components/GitHub.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
 
32 32
     public function getFull_name()
33 33
     {
34
-        return $this->getVendor() . '/' . $this->getName();
34
+        return $this->getVendor().'/'.$this->getName();
35 35
     }
36 36
 
37 37
     public function setFullName($value)
Please login to merge, or discard this patch.
src/log/ConsoleTarget.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
         if ($style) {
40 40
             $message = Console::ansiFormat($message, $style);
41 41
         }
42
-        Console::stdout($message . "\n");
42
+        Console::stdout($message."\n");
43 43
     }
44 44
 
45 45
     public function getLevel()
Please login to merge, or discard this patch.
src/base/Starter.php 2 patches
Doc Comments   +7 added lines, -1 removed lines patch added patch discarded remove patch
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
     /**
234 234
      * Passthru command.
235 235
      * @param string $command
236
-     * @param array $args
236
+     * @param string[] $args
237 237
      * @return int exit code
238 238
      */
239 239
     private function passthru($command, $args)
@@ -299,6 +299,9 @@  discard block
 block discarded – undo
299 299
         }
300 300
     }
301 301
 
302
+    /**
303
+     * @param string $value
304
+     */
302 305
     public function setRootDir($value)
303 306
     {
304 307
         $this->_rootDir = $value;
@@ -330,6 +333,9 @@  discard block
 block discarded – undo
330 333
         throw new InvalidParamException("Not a hidev project (or any of the parent directories).\nUse `hidev init` to initialize hidev project.");
331 334
     }
332 335
 
336
+    /**
337
+     * @param string $subpath
338
+     */
333 339
     public function buildRootPath($subpath)
334 340
     {
335 341
         return $this->getRootDir() . DIRECTORY_SEPARATOR . $subpath;
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
         Yii::setAlias('@hidev', dirname(__DIR__));
163 163
 
164 164
         $package = $this->goals['package'];
165
-        $alias  = isset($package['namespace']) ? strtr($package['namespace'], '\\', '/') : '';
166
-        if ($alias && !Yii::getAlias('@' . $alias, false)) {
167
-            $srcdir = Yii::getAlias('@root/' . ($package['src'] ?: 'src'));
165
+        $alias = isset($package['namespace']) ? strtr($package['namespace'], '\\', '/') : '';
166
+        if ($alias && !Yii::getAlias('@'.$alias, false)) {
167
+            $srcdir = Yii::getAlias('@root/'.($package['src'] ?: 'src'));
168 168
             Yii::setAlias($alias, $srcdir);
169 169
         }
170 170
         $aliases = $this->goals['aliases'];
@@ -331,6 +331,6 @@  discard block
 block discarded – undo
331 331
 
332 332
     public function buildRootPath($subpath)
333 333
     {
334
-        return $this->getRootDir() . DIRECTORY_SEPARATOR . $subpath;
334
+        return $this->getRootDir().DIRECTORY_SEPARATOR.$subpath;
335 335
     }
336 336
 }
Please login to merge, or discard this patch.