@@ -51,7 +51,7 @@ |
||
| 51 | 51 | |
| 52 | 52 | public function actionSave() |
| 53 | 53 | { |
| 54 | - $this->getFile()->write(implode(' ', [$this->version, $this->date, $this->time, $this->zone, $this->hash]) . "\n"); |
|
| 54 | + $this->getFile()->write(implode(' ', [$this->version, $this->date, $this->time, $this->zone, $this->hash])."\n"); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | public function setVersion($version = null) |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | $this->package = $package; |
| 50 | 50 | } |
| 51 | 51 | if (!$this->package || !$this->vendor) { |
| 52 | - throw new InvalidParamException('Wrong vendor/package given: ' . $name); |
|
| 52 | + throw new InvalidParamException('Wrong vendor/package given: '.$name); |
|
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | |
@@ -46,16 +46,16 @@ discard block |
||
| 46 | 46 | { |
| 47 | 47 | $path = parent::detectCommand($path); |
| 48 | 48 | |
| 49 | - return is_executable($path) ? $path : '/usr/bin/env php ' . $path; |
|
| 49 | + return is_executable($path) ? $path : '/usr/bin/env php '.$path; |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | public function install() |
| 53 | 53 | { |
| 54 | 54 | if ($this->installer) { |
| 55 | - passthru('/usr/bin/env wget ' . escapeshellarg($this->installer) . ' -O- | /usr/bin/env php', $exitcode); |
|
| 55 | + passthru('/usr/bin/env wget '.escapeshellarg($this->installer).' -O- | /usr/bin/env php', $exitcode); |
|
| 56 | 56 | } elseif ($this->download) { |
| 57 | - $dest = Yii::getAlias('@root/' . $this->name . '.phar', false); |
|
| 58 | - passthru('/usr/bin/env wget ' . escapeshellarg($this->download) . ' -O ' . $dest, $exitcode); |
|
| 57 | + $dest = Yii::getAlias('@root/'.$this->name.'.phar', false); |
|
| 58 | + passthru('/usr/bin/env wget '.escapeshellarg($this->download).' -O '.$dest, $exitcode); |
|
| 59 | 59 | } else { |
| 60 | 60 | return parent::install(); |
| 61 | 61 | } |
@@ -65,6 +65,6 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | public function getVcsignore() |
| 67 | 67 | { |
| 68 | - return $this->name . '.phar'; |
|
| 68 | + return $this->name.'.phar'; |
|
| 69 | 69 | } |
| 70 | 70 | } |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | foreach ($this->getItems() as $id => $config) { |
| 41 | 41 | $defaults = [ |
| 42 | 42 | 'class' => isset($config['template']) || isset($config['copy']) ? 'template' : 'directory', |
| 43 | - 'file' => $this->path . '/' . $id, |
|
| 43 | + 'file' => $this->path.'/'.$id, |
|
| 44 | 44 | ]; |
| 45 | 45 | if ($this->recursive) { |
| 46 | 46 | $defaults['recursive'] = $this->recursive; |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | public function mkdir($path) |
| 59 | 59 | { |
| 60 | - Yii::warning('mkdir ' . $path, 'dir'); |
|
| 60 | + Yii::warning('mkdir '.$path, 'dir'); |
|
| 61 | 61 | mkdir($path); |
| 62 | 62 | } |
| 63 | 63 | } |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | */ |
| 124 | 124 | protected static $_extension2type = [ |
| 125 | 125 | 'json' => 'json', |
| 126 | - 'yml' => 'yaml', /// first one is preferred |
|
| 126 | + 'yml' => 'yaml', /// first one is preferred |
|
| 127 | 127 | 'yaml' => 'yaml', |
| 128 | 128 | 'xml' => 'xml', |
| 129 | 129 | 'xml.dist' => 'xml', |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | public function setBasename($basename) |
| 178 | 178 | { |
| 179 | - $this->setPath($this->_dirname . '/' . $basename); |
|
| 179 | + $this->setPath($this->_dirname.'/'.$basename); |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | public function getBasename() |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | |
| 187 | 187 | public function setDirname($dirname) |
| 188 | 188 | { |
| 189 | - $this->setPath($dirname . '/' . $this->_basename); |
|
| 189 | + $this->setPath($dirname.'/'.$this->_basename); |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | public function getDirname() |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | |
| 197 | 197 | public function setFilename($filename) |
| 198 | 198 | { |
| 199 | - $this->setPath($this->_dirname . '/' . $filename . '.' . $this->_extension); |
|
| 199 | + $this->setPath($this->_dirname.'/'.$filename.'.'.$this->_extension); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | public function getFilename() |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | |
| 207 | 207 | public function setExtension($extension) |
| 208 | 208 | { |
| 209 | - $this->setPath($this->_dirname . '/' . $this->_filename . '.' . $extension); |
|
| 209 | + $this->setPath($this->_dirname.'/'.$this->_filename.'.'.$extension); |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | public function getExtension() |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | { |
| 258 | 258 | if (!is_object($this->_handler)) { |
| 259 | 259 | $this->_handler = Yii::createObject([ |
| 260 | - 'class' => 'hidev\handlers\\' . $this->getCtype() . 'Handler', |
|
| 260 | + 'class' => 'hidev\handlers\\'.$this->getCtype().'Handler', |
|
| 261 | 261 | 'template' => $this->template, |
| 262 | 262 | 'goal' => $this->goal, |
| 263 | 263 | ]); |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | |
| 361 | 361 | public function chown($value) |
| 362 | 362 | { |
| 363 | - $ownergroup = $this->getOwner() . ':' . $this->getGroup(); |
|
| 363 | + $ownergroup = $this->getOwner().':'.$this->getGroup(); |
|
| 364 | 364 | if (in_array((string) $value, [$ownergroup, $this->getOwner(), $this->getUid()], true)) { |
| 365 | 365 | return; |
| 366 | 366 | } |
@@ -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()); |
@@ -49,16 +49,16 @@ |
||
| 49 | 49 | { |
| 50 | 50 | $path = parent::detectCommand($path); |
| 51 | 51 | |
| 52 | - return is_executable($path) ? $path : '/usr/bin/env python ' . $path; |
|
| 52 | + return is_executable($path) ? $path : '/usr/bin/env python '.$path; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | public function install() |
| 56 | 56 | { |
| 57 | 57 | if ($this->installer) { |
| 58 | - passthru('/usr/bin/env wget ' . escapeshellarg($this->installer) . ' -O- | /usr/bin/env python', $exitcode); |
|
| 58 | + passthru('/usr/bin/env wget '.escapeshellarg($this->installer).' -O- | /usr/bin/env python', $exitcode); |
|
| 59 | 59 | } elseif ($this->download) { |
| 60 | - $dest = Yii::getAlias('@root/' . $this->name, false); |
|
| 61 | - passthru('/usr/bin/env wget ' . escapeshellarg($this->download) . ' -O ' . $dest, $exitcode); |
|
| 60 | + $dest = Yii::getAlias('@root/'.$this->name, false); |
|
| 61 | + passthru('/usr/bin/env wget '.escapeshellarg($this->download).' -O '.$dest, $exitcode); |
|
| 62 | 62 | } else { |
| 63 | 63 | $args = ['install']; |
| 64 | 64 | if (!$_SERVER['VIRTUAL_ENV']) { |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | |
| 26 | 26 | public function actionMake($version = null) |
| 27 | 27 | { |
| 28 | - $path = dirname(dirname(__DIR__)) . '/bin/hidev'; |
|
| 28 | + $path = dirname(dirname(__DIR__)).'/bin/hidev'; |
|
| 29 | 29 | echo "HiDev $this->version $this->date $this->time $this->hash\n"; |
| 30 | 30 | echo "run from $path\n"; |
| 31 | 31 | } |
@@ -8,24 +8,24 @@ |
||
| 8 | 8 | * @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/) |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | -require_once __DIR__ . '/defines.php'; |
|
| 11 | +require_once __DIR__.'/defines.php'; |
|
| 12 | 12 | |
| 13 | 13 | if (!defined('HIDEV_VENDOR_DIR')) { |
| 14 | - foreach ([dirname(dirname(__DIR__)) . '/vendor', dirname(dirname(dirname(dirname(__DIR__))))] as $dir) { |
|
| 15 | - if (file_exists($dir . '/autoload.php')) { |
|
| 14 | + foreach ([dirname(dirname(__DIR__)).'/vendor', dirname(dirname(dirname(dirname(__DIR__))))] as $dir) { |
|
| 15 | + if (file_exists($dir.'/autoload.php')) { |
|
| 16 | 16 | define('HIDEV_VENDOR_DIR', $dir); |
| 17 | 17 | break; |
| 18 | 18 | } |
| 19 | 19 | } |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | -if (!defined('HIDEV_VENDOR_DIR') || !file_exists(HIDEV_VENDOR_DIR . '/autoload.php')) { |
|
| 22 | +if (!defined('HIDEV_VENDOR_DIR') || !file_exists(HIDEV_VENDOR_DIR.'/autoload.php')) { |
|
| 23 | 23 | fwrite(STDERR, "Run composer to set up dependencies!\n"); |
| 24 | 24 | exit(1); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | -require_once HIDEV_VENDOR_DIR . '/autoload.php'; |
|
| 28 | -require_once HIDEV_VENDOR_DIR . '/yiisoft/yii2/Yii.php'; |
|
| 27 | +require_once HIDEV_VENDOR_DIR.'/autoload.php'; |
|
| 28 | +require_once HIDEV_VENDOR_DIR.'/yiisoft/yii2/Yii.php'; |
|
| 29 | 29 | |
| 30 | 30 | Yii::setAlias('@hidev', dirname(__DIR__)); |
| 31 | 31 | Yii::setAlias('@vendor', HIDEV_VENDOR_DIR); |
@@ -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; |