@@ -59,6 +59,9 @@ discard block |
||
| 59 | 59 | $this->_hash = $hash; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | + /** |
|
| 63 | + * @param string $label |
|
| 64 | + */ |
|
| 62 | 65 | public function addTag($tag, $label = null) |
| 63 | 66 | { |
| 64 | 67 | $this->tag = $tag; |
@@ -66,6 +69,9 @@ discard block |
||
| 66 | 69 | $ref = $label ?: $ref ?: $tag; |
| 67 | 70 | } |
| 68 | 71 | |
| 72 | + /** |
|
| 73 | + * @param string $note |
|
| 74 | + */ |
|
| 69 | 75 | public function addNote($note, $label = null) |
| 70 | 76 | { |
| 71 | 77 | $this->note = $note; |
@@ -73,6 +79,10 @@ discard block |
||
| 73 | 79 | $ref = $label ?: $ref ?: $note; |
| 74 | 80 | } |
| 75 | 81 | |
| 82 | + /** |
|
| 83 | + * @param string $hash |
|
| 84 | + * @param string $label |
|
| 85 | + */ |
|
| 76 | 86 | public function addHash($hash, $label) |
| 77 | 87 | { |
| 78 | 88 | $this->_hash = $hash; |
@@ -183,6 +193,9 @@ discard block |
||
| 183 | 193 | return $res; |
| 184 | 194 | } |
| 185 | 195 | |
| 196 | + /** |
|
| 197 | + * @param string $key |
|
| 198 | + */ |
|
| 186 | 199 | public static function arrayPop(&$array, $key) |
| 187 | 200 | { |
| 188 | 201 | $res = $array[$key]; |
@@ -239,6 +252,9 @@ discard block |
||
| 239 | 252 | return $date ? date(' Y-m-d', strtotime($date)) : ''; |
| 240 | 253 | } |
| 241 | 254 | |
| 255 | + /** |
|
| 256 | + * @param string $string |
|
| 257 | + */ |
|
| 242 | 258 | public static function renderHeader($string) |
| 243 | 259 | { |
| 244 | 260 | $header = Yii::$app->config->package->fullName . ' ' . $string; |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | { |
| 213 | 213 | $res = implode("\n", array_filter($lines)); |
| 214 | 214 | |
| 215 | - return $res ? $res . "\n" : ''; |
|
| 215 | + return $res ? $res."\n" : ''; |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | public static function renderCommit($commit) |
@@ -262,9 +262,9 @@ discard block |
||
| 262 | 262 | |
| 263 | 263 | public static function renderHeader($string) |
| 264 | 264 | { |
| 265 | - $header = Yii::$app->config->package->fullName . ' ' . $string; |
|
| 265 | + $header = Yii::$app->config->package->fullName.' '.$string; |
|
| 266 | 266 | |
| 267 | - return $header . "\n" . str_repeat('-', mb_strlen($header, Yii::$app->charset)) . "\n"; |
|
| 267 | + return $header."\n".str_repeat('-', mb_strlen($header, Yii::$app->charset))."\n"; |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | public static function getVcs() |
@@ -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); |
@@ -69,7 +69,6 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | /** |
| 71 | 71 | * Load extra config files. |
| 72 | - * @param array $config |
|
| 73 | 72 | * @return void |
| 74 | 73 | */ |
| 75 | 74 | public function loadExtraVendor($dir) |
@@ -134,6 +133,9 @@ discard block |
||
| 134 | 133 | return $controller; |
| 135 | 134 | } |
| 136 | 135 | |
| 136 | + /** |
|
| 137 | + * @param string $string |
|
| 138 | + */ |
|
| 137 | 139 | public function runRequest($string) |
| 138 | 140 | { |
| 139 | 141 | $request = Yii::createObject([ |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | |
| 64 | 64 | public static function readExtraVendor($dir) |
| 65 | 65 | { |
| 66 | - return static::readExtraConfig($dir . '/hiqdev/hidev-config.php'); |
|
| 66 | + return static::readExtraConfig($dir.'/hiqdev/hidev-config.php'); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | public static function readExtraConfig($path) |
@@ -122,6 +122,9 @@ discard block |
||
| 122 | 122 | return $type2extension[$type]; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | + /** |
|
| 126 | + * @param string $extension |
|
| 127 | + */ |
|
| 125 | 128 | public function getTypeByExtension($extension) |
| 126 | 129 | { |
| 127 | 130 | return static::$_extension2type[$extension]; |
@@ -132,6 +135,9 @@ discard block |
||
| 132 | 135 | return ($this->goal ? $this->goal->fileType : null) ?: static::getTypeByExtension($this->_extension) ?: 'template'; |
| 133 | 136 | } |
| 134 | 137 | |
| 138 | + /** |
|
| 139 | + * @param string $path |
|
| 140 | + */ |
|
| 135 | 141 | public function setPath($path) |
| 136 | 142 | { |
| 137 | 143 | $path = Yii::getAlias($path); |
@@ -208,6 +214,9 @@ discard block |
||
| 208 | 214 | return $this->handler->renderPath($this->path, $this->data); |
| 209 | 215 | } |
| 210 | 216 | |
| 217 | + /** |
|
| 218 | + * @param string $content |
|
| 219 | + */ |
|
| 211 | 220 | public function write($content) |
| 212 | 221 | { |
| 213 | 222 | return $this->handler->write($this->path, $content); |
@@ -218,6 +227,9 @@ discard block |
||
| 218 | 227 | return $this->data = $this->handler->parsePath($this->path, $this->minimalPath); |
| 219 | 228 | } |
| 220 | 229 | |
| 230 | + /** |
|
| 231 | + * @return string |
|
| 232 | + */ |
|
| 221 | 233 | public function read() |
| 222 | 234 | { |
| 223 | 235 | return $this->handler->read($this->path); |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | protected static $_extension2type = [ |
| 111 | 111 | 'json' => 'json', |
| 112 | - 'yml' => 'yaml', /// first one is preferred |
|
| 112 | + 'yml' => 'yaml', /// first one is preferred |
|
| 113 | 113 | 'yaml' => 'yaml', |
| 114 | 114 | 'xml' => 'xml', |
| 115 | 115 | 'xml.dist' => 'xml', |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | |
| 159 | 159 | public function setBasename($basename) |
| 160 | 160 | { |
| 161 | - $this->setPath($this->_dirname . '/' . $basename); |
|
| 161 | + $this->setPath($this->_dirname.'/'.$basename); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | public function getBasename() |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | |
| 169 | 169 | public function setDirname($dirname) |
| 170 | 170 | { |
| 171 | - $this->setPath($dirname . '/' . $this->_basename); |
|
| 171 | + $this->setPath($dirname.'/'.$this->_basename); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | public function getDirname() |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | |
| 179 | 179 | public function setFilename($filename) |
| 180 | 180 | { |
| 181 | - $this->setPath($this->_dirname . '/' . $filename . '.' . $this->_extension); |
|
| 181 | + $this->setPath($this->_dirname.'/'.$filename.'.'.$this->_extension); |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | public function getFilename() |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | |
| 189 | 189 | public function setExtension($extension) |
| 190 | 190 | { |
| 191 | - $this->setPath($this->_dirname . '/' . $this->_filename . '.' . $extension); |
|
| 191 | + $this->setPath($this->_dirname.'/'.$this->_filename.'.'.$extension); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | public function getExtension() |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | { |
| 240 | 240 | if (!is_object($this->_handler)) { |
| 241 | 241 | $this->_handler = Yii::createObject([ |
| 242 | - 'class' => 'hidev\handlers\\' . $this->getCtype() . 'Handler', |
|
| 242 | + 'class' => 'hidev\handlers\\'.$this->getCtype().'Handler', |
|
| 243 | 243 | 'template' => $this->template, |
| 244 | 244 | 'goal' => $this->goal, |
| 245 | 245 | ]); |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | |
| 337 | 337 | public function chown($value) |
| 338 | 338 | { |
| 339 | - $ownergroup = $this->getOwner() . ':' . $this->getGroup(); |
|
| 339 | + $ownergroup = $this->getOwner().':'.$this->getGroup(); |
|
| 340 | 340 | if (in_array($value, [$ownergroup, $this->getOwner(), $this->getUid()], false)) { |
| 341 | 341 | return; |
| 342 | 342 | } |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | class FileController extends CollectionController |
| 23 | 23 | { |
| 24 | - protected $_make = ['load', 'save', 'modify']; |
|
| 24 | + protected $_make = ['load', 'save', 'modify']; |
|
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * @var string specifies handler to be used |
@@ -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; |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | public function getFull_name() |
| 36 | 36 | { |
| 37 | - return $this->getVendor() . '/' . $this->getName(); |
|
| 37 | + return $this->getVendor().'/'.$this->getName(); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function setFullName($value) |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | public function actionCreate() |
| 97 | 97 | { |
| 98 | - $res = $this->request('POST', '/orgs/' . $this->getVendor() . '/repos', [ |
|
| 98 | + $res = $this->request('POST', '/orgs/'.$this->getVendor().'/repos', [ |
|
| 99 | 99 | 'name' => $this->getName(), |
| 100 | 100 | 'description' => $this->getDescription(), |
| 101 | 101 | ]); |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | public function actionClone($repo) |
| 116 | 116 | { |
| 117 | - return $this->passthru('git', ['clone', '[email protected]:' . $repo]); |
|
| 117 | + return $this->passthru('git', ['clone', '[email protected]:'.$repo]); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | /** |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | public static function exists($repo) |
| 136 | 136 | { |
| 137 | - return !static::exec('git', ['ls-remote', '[email protected]:' . $repo], true); |
|
| 137 | + return !static::exec('git', ['ls-remote', '[email protected]:'.$repo], true); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | public function actionRelease($version = null) |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | return $wait; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - return $this->request('POST', '/repos/' . $this->getFull_name() . '/releases', [ |
|
| 151 | + return $this->request('POST', '/repos/'.$this->getFull_name().'/releases', [ |
|
| 152 | 152 | 'tag_name' => $version, |
| 153 | 153 | 'name' => $version, |
| 154 | 154 | 'body' => $notes, |
@@ -169,9 +169,9 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | public function request($method, $path, $data) |
| 171 | 171 | { |
| 172 | - $url = 'https://api.github.com' . $path; |
|
| 172 | + $url = 'https://api.github.com'.$path; |
|
| 173 | 173 | |
| 174 | - return $this->passthru('curl', ['-X', $method, '-H', 'Authorization: token ' . $this->getToken(), '--data', Json::encode($data), $url]); |
|
| 174 | + return $this->passthru('curl', ['-X', $method, '-H', 'Authorization: token '.$this->getToken(), '--data', Json::encode($data), $url]); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | public function findToken() |
@@ -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); |
@@ -70,6 +76,9 @@ discard block |
||
| 70 | 76 | return array_combine($res, $res); |
| 71 | 77 | } |
| 72 | 78 | |
| 79 | + /** |
|
| 80 | + * @param string $subj |
|
| 81 | + */ |
|
| 73 | 82 | public static function getPublicVars($subj) |
| 74 | 83 | { |
| 75 | 84 | return is_object($subj) ? get_object_vars($subj) : get_class_vars($subj); |
@@ -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 | { |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | if (!is_file($path) || file_get_contents($path) !== $content) { |
| 127 | 127 | $this->mkdir(dirname($path)); |
| 128 | 128 | file_put_contents($path, $content); |
| 129 | - Yii::warning('Written file: ' . $path, 'file'); |
|
| 129 | + Yii::warning('Written file: '.$path, 'file'); |
|
| 130 | 130 | |
| 131 | 131 | return true; |
| 132 | 132 | } |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | $path = trim(trim($path), '/'); |
| 145 | 145 | if (!file_exists($path)) { |
| 146 | 146 | mkdir($path, 0777, true); |
| 147 | - Yii::warning('Created dir: ' . $path . '/', 'file'); |
|
| 147 | + Yii::warning('Created dir: '.$path.'/', 'file'); |
|
| 148 | 148 | |
| 149 | 149 | return true; |
| 150 | 150 | } |
@@ -161,11 +161,11 @@ discard block |
||
| 161 | 161 | public function read($path, $asArray = false) |
| 162 | 162 | { |
| 163 | 163 | if (file_exists($path)) { |
| 164 | - Yii::info('Read file: ' . $path, 'file'); |
|
| 164 | + Yii::info('Read file: '.$path, 'file'); |
|
| 165 | 165 | |
| 166 | 166 | return $asArray ? file($path) : file_get_contents($path); |
| 167 | 167 | } else { |
| 168 | - Yii::error('Couldn\'t read file: ' . $path, 'file'); |
|
| 168 | + Yii::error('Couldn\'t read file: '.$path, 'file'); |
|
| 169 | 169 | |
| 170 | 170 | return; |
| 171 | 171 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | - * @return int|Response exit code |
|
| 51 | + * @return null|integer exit code |
|
| 52 | 52 | */ |
| 53 | 53 | public function actionMake() |
| 54 | 54 | { |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | /** |
| 143 | 143 | * Is response NOT Ok. |
| 144 | 144 | * @param Response|int $res |
| 145 | - * @return bool |
|
| 145 | + * @return integer |
|
| 146 | 146 | */ |
| 147 | 147 | public static function isNotOk($res) |
| 148 | 148 | { |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | |
| 152 | 152 | /** |
| 153 | 153 | * Is response Ok. |
| 154 | - * @param Response|int $res |
|
| 154 | + * @param integer $res |
|
| 155 | 155 | * @return bool |
| 156 | 156 | */ |
| 157 | 157 | public static function isOk($res) |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | * Runs list of actions. |
| 164 | 164 | * TODO: think to redo with runRequests. |
| 165 | 165 | * @param null|string|array $actions |
| 166 | - * @return int|Response exit code |
|
| 166 | + * @return null|integer exit code |
|
| 167 | 167 | */ |
| 168 | 168 | public function runActions($actions) |
| 169 | 169 | { |
@@ -240,6 +240,9 @@ discard block |
||
| 240 | 240 | return readline($prompt); |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | + /** |
|
| 244 | + * @param string $prompt |
|
| 245 | + */ |
|
| 243 | 246 | public function readpassword($prompt) |
| 244 | 247 | { |
| 245 | 248 | echo $prompt; |
@@ -250,6 +253,9 @@ discard block |
||
| 250 | 253 | return $password; |
| 251 | 254 | } |
| 252 | 255 | |
| 256 | + /** |
|
| 257 | + * @param string $id |
|
| 258 | + */ |
|
| 253 | 259 | public static function takeGoal($id) |
| 254 | 260 | { |
| 255 | 261 | return Yii::$app->get('config')->getGoal($id); |