@@ -72,6 +72,9 @@ |
||
| 72 | 72 | return false; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | + /** |
|
| 76 | + * @param string $id |
|
| 77 | + */ |
|
| 75 | 78 | public function getGoal($id) |
| 76 | 79 | { |
| 77 | 80 | return Yii::$app->createControllerById($id); |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | /** |
| 114 | 114 | * Action to check if repo exists. |
| 115 | 115 | * @param string $repo full name vendor/package defaults to this repo name |
| 116 | - * @return int exit code |
|
| 116 | + * @return boolean exit code |
|
| 117 | 117 | */ |
| 118 | 118 | public function actionExists($repo = null) |
| 119 | 119 | { |
@@ -160,6 +160,10 @@ discard block |
||
| 160 | 160 | return 0; |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | + /** |
|
| 164 | + * @param string $method |
|
| 165 | + * @param string $path |
|
| 166 | + */ |
|
| 163 | 167 | public function request($method, $path, $data) |
| 164 | 168 | { |
| 165 | 169 | $url = 'https://api.github.com' . $path; |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | * |
| 92 | 92 | * @param mixed $data |
| 93 | 93 | * |
| 94 | - * @return string file content |
|
| 94 | + * @return boolean file content |
|
| 95 | 95 | */ |
| 96 | 96 | public function renderPath($path, $data) |
| 97 | 97 | { |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | * Read file into a string or array. |
| 157 | 157 | * @param string $path |
| 158 | 158 | * @param bool $asArray |
| 159 | - * @return string|array |
|
| 159 | + * @return string |
|
| 160 | 160 | */ |
| 161 | 161 | public function read($path, $asArray = false) |
| 162 | 162 | { |
@@ -19,11 +19,17 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | class Helper |
| 21 | 21 | { |
| 22 | + /** |
|
| 23 | + * @return string |
|
| 24 | + */ |
|
| 22 | 25 | public static function bad2sep($str, $separator = '-') |
| 23 | 26 | { |
| 24 | 27 | return preg_replace('/[^a-zA-Z0-9-]/', $separator, $str); |
| 25 | 28 | } |
| 26 | 29 | |
| 30 | + /** |
|
| 31 | + * @param string $id |
|
| 32 | + */ |
|
| 27 | 33 | public static function id2camel($id, $separator = '-') |
| 28 | 34 | { |
| 29 | 35 | return Inflector::id2camel(self::bad2sep($id, $separator), $separator); |
@@ -35,6 +41,9 @@ discard block |
||
| 35 | 41 | return str_replace('--', '-', Inflector::camel2id(str_replace(' ', '', ucwords($name)), $separator, $strict)); |
| 36 | 42 | } |
| 37 | 43 | |
| 44 | + /** |
|
| 45 | + * @param string $file |
|
| 46 | + */ |
|
| 38 | 47 | public static function file2template($file, $separator = '-') |
| 39 | 48 | { |
| 40 | 49 | return trim($file, '.'); |
@@ -70,6 +79,9 @@ discard block |
||
| 70 | 79 | return array_combine($res, $res); |
| 71 | 80 | } |
| 72 | 81 | |
| 82 | + /** |
|
| 83 | + * @param string $subj |
|
| 84 | + */ |
|
| 73 | 85 | public static function getPublicVars($subj) |
| 74 | 86 | { |
| 75 | 87 | return is_object($subj) ? get_object_vars($subj) : get_class_vars($subj); |
@@ -86,7 +86,6 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | /** |
| 88 | 88 | * Load extra config files. |
| 89 | - * @param array $config |
|
| 90 | 89 | */ |
| 91 | 90 | public function loadExtraVendor($dir) |
| 92 | 91 | { |
@@ -185,8 +184,8 @@ discard block |
||
| 185 | 184 | |
| 186 | 185 | /** |
| 187 | 186 | * Run request. |
| 188 | - * @param string|array $query |
|
| 189 | - * @return Response |
|
| 187 | + * @param string $query |
|
| 188 | + * @return \yii\console\Response |
|
| 190 | 189 | */ |
| 191 | 190 | public function runRequest($query) |
| 192 | 191 | { |
@@ -143,6 +143,9 @@ discard block |
||
| 143 | 143 | return $type2extension[$type]; |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | + /** |
|
| 147 | + * @param string $extension |
|
| 148 | + */ |
|
| 146 | 149 | public function getTypeByExtension($extension) |
| 147 | 150 | { |
| 148 | 151 | return isset(static::$_extension2type[$extension]) ? static::$_extension2type[$extension] : null; |
@@ -157,6 +160,9 @@ discard block |
||
| 157 | 160 | return ($this->goal ? $this->goal->fileType : null) ?: static::getTypeByExtension($this->_extension) ?: 'template'; |
| 158 | 161 | } |
| 159 | 162 | |
| 163 | + /** |
|
| 164 | + * @param string $path |
|
| 165 | + */ |
|
| 160 | 166 | public function setPath($path) |
| 161 | 167 | { |
| 162 | 168 | $path = Yii::getAlias($path); |
@@ -233,6 +239,9 @@ discard block |
||
| 233 | 239 | return $this->getHandler()->renderPath($this->getPath(), $this->data); |
| 234 | 240 | } |
| 235 | 241 | |
| 242 | + /** |
|
| 243 | + * @param string $content |
|
| 244 | + */ |
|
| 236 | 245 | public function write($content) |
| 237 | 246 | { |
| 238 | 247 | return $this->getHandler()->write($this->getPath(), $content); |
@@ -243,6 +252,9 @@ discard block |
||
| 243 | 252 | return $this->data = $this->getHandler()->parsePath($this->getPath(), $this->getMinimalPath()); |
| 244 | 253 | } |
| 245 | 254 | |
| 255 | + /** |
|
| 256 | + * @return string |
|
| 257 | + */ |
|
| 246 | 258 | public function read() |
| 247 | 259 | { |
| 248 | 260 | return $this->getHandler()->read($this->getPath()); |
@@ -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 | { |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | |
| 151 | 151 | /** |
| 152 | 152 | * Is response Ok. |
| 153 | - * @param Response|int $res |
|
| 153 | + * @param integer $res |
|
| 154 | 154 | * @return bool |
| 155 | 155 | */ |
| 156 | 156 | public static function isOk($res) |
@@ -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 | { |
@@ -244,6 +244,9 @@ discard block |
||
| 244 | 244 | return readline($prompt); |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | + /** |
|
| 248 | + * @param string $prompt |
|
| 249 | + */ |
|
| 247 | 250 | public function readpassword($prompt) |
| 248 | 251 | { |
| 249 | 252 | echo $prompt; |
@@ -255,6 +258,9 @@ discard block |
||
| 255 | 258 | return $password; |
| 256 | 259 | } |
| 257 | 260 | |
| 261 | + /** |
|
| 262 | + * @param string $id |
|
| 263 | + */ |
|
| 258 | 264 | public function takeGoal($id) |
| 259 | 265 | { |
| 260 | 266 | return $this->module->get('config')->getGoal($id); |