@@ -56,6 +56,9 @@ |
||
| 56 | 56 | return readline($prompt); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | + /** |
|
| 60 | + * @param string $prompt |
|
| 61 | + */ |
|
| 59 | 62 | public function readpassword($prompt) |
| 60 | 63 | { |
| 61 | 64 | echo $prompt; |
@@ -88,7 +88,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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()); |
@@ -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; |
@@ -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') { |
@@ -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 = []) |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | /** |
| 121 | 121 | * Checks if repo exists. |
| 122 | 122 | * @param string $repo full name vendor/package defaults to this repo name |
| 123 | - * @return int exit code |
|
| 123 | + * @return boolean exit code |
|
| 124 | 124 | */ |
| 125 | 125 | public function actionExists($repo = null) |
| 126 | 126 | { |
@@ -168,6 +168,10 @@ discard block |
||
| 168 | 168 | return 0; |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | + /** |
|
| 172 | + * @param string $method |
|
| 173 | + * @param string $path |
|
| 174 | + */ |
|
| 171 | 175 | public function request($method, $path, $data) |
| 172 | 176 | { |
| 173 | 177 | $url = 'https://api.github.com' . $path; |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | * Renders file content using given data. |
| 84 | 84 | * Converts to array with ArrayHelper::toArray. |
| 85 | 85 | * @param mixed $data |
| 86 | - * @return string file content |
|
| 86 | + * @return boolean file content |
|
| 87 | 87 | */ |
| 88 | 88 | public function renderPath($path, $data) |
| 89 | 89 | { |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | * Read file into a string or array. |
| 133 | 133 | * @param string $path |
| 134 | 134 | * @param bool $asArray |
| 135 | - * @return string|array |
|
| 135 | + * @return string |
|
| 136 | 136 | */ |
| 137 | 137 | public function read($path, $asArray = false) |
| 138 | 138 | { |
@@ -24,11 +24,17 @@ |
||
| 24 | 24 | return method_exists(Yii::class, 'autoload'); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | + /** |
|
| 28 | + * @return string |
|
| 29 | + */ |
|
| 27 | 30 | public static function bad2sep($str, $separator = '-') |
| 28 | 31 | { |
| 29 | 32 | return preg_replace('/[^a-zA-Z0-9-]/', $separator, $str); |
| 30 | 33 | } |
| 31 | 34 | |
| 35 | + /** |
|
| 36 | + * @param string $id |
|
| 37 | + */ |
|
| 32 | 38 | public static function id2camel($id, $separator = '-') |
| 33 | 39 | { |
| 34 | 40 | return Inflector::id2camel(self::bad2sep($id, $separator), $separator); |
@@ -69,6 +69,9 @@ discard block |
||
| 69 | 69 | ); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | + /** |
|
| 73 | + * @param string|null $name |
|
| 74 | + */ |
|
| 72 | 75 | public function prepareData($name) |
| 73 | 76 | { |
| 74 | 77 | $this->name = $name; |
@@ -162,6 +165,9 @@ discard block |
||
| 162 | 165 | return $this->title ?: Helper::titleize($this->package); |
| 163 | 166 | } |
| 164 | 167 | |
| 168 | + /** |
|
| 169 | + * @return string |
|
| 170 | + */ |
|
| 165 | 171 | public function getKeywords() |
| 166 | 172 | { |
| 167 | 173 | return $this->keywords ?: implode(', ', explode('-', $this->package)); |