@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | /** |
| 228 | 228 | * Passthru command. |
| 229 | 229 | * @param string $command |
| 230 | - * @param array $args |
|
| 230 | + * @param string[] $args |
|
| 231 | 231 | * @return int exit code |
| 232 | 232 | */ |
| 233 | 233 | private function passthru($command, $args) |
@@ -324,6 +324,9 @@ discard block |
||
| 324 | 324 | throw new InvalidParamException("Not a hidev project (or any of the parent directories).\nUse `hidev init` to initialize hidev project."); |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | + /** |
|
| 328 | + * @param string $subpath |
|
| 329 | + */ |
|
| 327 | 330 | public function buildRootPath($subpath) |
| 328 | 331 | { |
| 329 | 332 | return $this->getRootDir() . DIRECTORY_SEPARATOR . $subpath; |
@@ -157,9 +157,9 @@ discard block |
||
| 157 | 157 | Yii::setAlias('@root', $this->getRootDir()); |
| 158 | 158 | Yii::setAlias('@hidev', dirname(__DIR__)); |
| 159 | 159 | $package = $this->goals['package']; |
| 160 | - $alias = isset($package['namespace']) ? strtr($package['namespace'], '\\', '/') : ''; |
|
| 161 | - if ($alias && !Yii::getAlias('@' . $alias, false)) { |
|
| 162 | - $srcdir = Yii::getAlias('@root/' . ($package['src'] ?: 'src')); |
|
| 160 | + $alias = isset($package['namespace']) ? strtr($package['namespace'], '\\', '/') : ''; |
|
| 161 | + if ($alias && !Yii::getAlias('@'.$alias, false)) { |
|
| 162 | + $srcdir = Yii::getAlias('@root/'.($package['src'] ?: 'src')); |
|
| 163 | 163 | Yii::setAlias($alias, $srcdir); |
| 164 | 164 | } |
| 165 | 165 | $aliases = $this->goals['aliases']; |
@@ -326,6 +326,6 @@ discard block |
||
| 326 | 326 | |
| 327 | 327 | public function buildRootPath($subpath) |
| 328 | 328 | { |
| 329 | - return $this->getRootDir() . DIRECTORY_SEPARATOR . $subpath; |
|
| 329 | + return $this->getRootDir().DIRECTORY_SEPARATOR.$subpath; |
|
| 330 | 330 | } |
| 331 | 331 | } |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | - * @return int|Response exit code |
|
| 50 | + * @return null|integer exit code |
|
| 51 | 51 | */ |
| 52 | 52 | public function actionMake() |
| 53 | 53 | { |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | /** |
| 142 | 142 | * Is response NOT Ok. |
| 143 | 143 | * @param Response|int $res |
| 144 | - * @return bool |
|
| 144 | + * @return integer |
|
| 145 | 145 | */ |
| 146 | 146 | public static function isNotOk($res) |
| 147 | 147 | { |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | * Runs list of actions. |
| 163 | 163 | * TODO: think to redo with runRequests. |
| 164 | 164 | * @param null|string|array $actions |
| 165 | - * @return int|Response exit code |
|
| 165 | + * @return null|integer exit code |
|
| 166 | 166 | */ |
| 167 | 167 | public function runActions($actions) |
| 168 | 168 | { |
@@ -58,6 +58,9 @@ |
||
| 58 | 58 | return $item; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | + /** |
|
| 62 | + * @param string $id |
|
| 63 | + */ |
|
| 61 | 64 | public function getGoal($id) |
| 62 | 65 | { |
| 63 | 66 | return Yii::$app->createControllerById($id); |
@@ -32,7 +32,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -35,6 +35,6 @@ |
||
| 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 | } |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | $this->interpolate($item); |
| 15 | 15 | } |
| 16 | 16 | } elseif (is_string($data)) { |
| 17 | - $data = preg_replace_callback('/\\$(\\w+)\\[\'(.+?)\'\\]/', function ($matches) { |
|
| 17 | + $data = preg_replace_callback('/\\$(\\w+)\\[\'(.+?)\'\\]/', function($matches) { |
|
| 18 | 18 | return $this->get($matches[1], $matches[2]); |
| 19 | 19 | }, $data); |
| 20 | 20 | } |
@@ -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() |