@@ -34,6 +34,6 @@ |
||
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 | } |
@@ -32,7 +32,7 @@ |
||
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() |
@@ -42,7 +42,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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() |
@@ -31,7 +31,7 @@ |
||
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) |
@@ -39,7 +39,7 @@ |
||
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() |
@@ -233,7 +233,7 @@ discard block |
||
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 |
||
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 |
||
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; |
@@ -162,9 +162,9 @@ discard block |
||
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 |
||
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 | } |
@@ -18,11 +18,17 @@ |
||
18 | 18 | */ |
19 | 19 | class Helper |
20 | 20 | { |
21 | + /** |
|
22 | + * @return string |
|
23 | + */ |
|
21 | 24 | public static function bad2sep($str, $separator = '-') |
22 | 25 | { |
23 | 26 | return preg_replace('/[^a-zA-Z0-9-]/', $separator, $str); |
24 | 27 | } |
25 | 28 | |
29 | + /** |
|
30 | + * @param string $id |
|
31 | + */ |
|
26 | 32 | public static function id2camel($id, $separator = '-') |
27 | 33 | { |
28 | 34 | return Inflector::id2camel(self::bad2sep($id, $separator), $separator); |
@@ -103,6 +103,9 @@ |
||
103 | 103 | return $release ?: $this->release ?: 'dev'; |
104 | 104 | } |
105 | 105 | |
106 | + /** |
|
107 | + * @param string $branch |
|
108 | + */ |
|
106 | 109 | public function setBranch($branch, $release = null) |
107 | 110 | { |
108 | 111 | if (isset($branch) && $release !== 'dev') { |
@@ -89,7 +89,7 @@ |
||
89 | 89 | |
90 | 90 | public function save() |
91 | 91 | { |
92 | - $this->getFile()->write($this->renderFile() . "\n"); |
|
92 | + $this->getFile()->write($this->renderFile()."\n"); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | public function setRelease($release = null, $branch = '') |
@@ -28,6 +28,9 @@ discard block |
||
28 | 28 | return $this->_view; |
29 | 29 | } |
30 | 30 | |
31 | + /** |
|
32 | + * @param string $id |
|
33 | + */ |
|
31 | 34 | public function take($id) |
32 | 35 | { |
33 | 36 | return $this->getApp()->get($id); |
@@ -43,7 +46,7 @@ discard block |
||
43 | 46 | * Command output passes unchanged to console. |
44 | 47 | * Returns exit code. |
45 | 48 | * @param string $name |
46 | - * @param array|string $args |
|
49 | + * @param string[] $args |
|
47 | 50 | * @return int exit code |
48 | 51 | */ |
49 | 52 | public function passthru($name, $args = []) |