@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | define('HIDEV_VENDOR_DIR', dirname(dirname(dirname(dirname(__DIR__))))); |
13 | 13 | } |
14 | 14 | |
15 | -$runtimePath = (substr(__DIR__, 0, 7) === 'phar://' ? dirname($_SERVER['SCRIPT_NAME']) : dirname(HIDEV_VENDOR_DIR)) . '/.hidev/runtime'; |
|
15 | +$runtimePath = (substr(__DIR__, 0, 7) === 'phar://' ? dirname($_SERVER['SCRIPT_NAME']) : dirname(HIDEV_VENDOR_DIR)).'/.hidev/runtime'; |
|
16 | 16 | |
17 | 17 | return [ |
18 | 18 | 'id' => 'hidev', |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | ], |
88 | 88 | 'own.version' => [ |
89 | 89 | 'class' => \hidev\components\Version::class, |
90 | - 'file' => dirname(dirname(__DIR__)) . '/version', |
|
90 | + 'file' => dirname(dirname(__DIR__)).'/version', |
|
91 | 91 | ], |
92 | 92 | ], |
93 | 93 | 'controllerMap' => [ |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | ], |
108 | 108 | 'container' => [ |
109 | 109 | 'singletons' => [ |
110 | - \hidev\components\AbstractVcs::class => function () { |
|
110 | + \hidev\components\AbstractVcs::class => function() { |
|
111 | 111 | $detectedVCS = 'git'; /// TODO actual detection to be added |
112 | 112 | return Yii::$app->get($detectedVCS); |
113 | 113 | }, |
@@ -45,7 +45,7 @@ |
||
45 | 45 | foreach ($this->getCommands() as $command) { |
46 | 46 | $command = trim($command); |
47 | 47 | if ($command) { |
48 | - passthru(($this->sudo ? 'sudo ' : '') . $command); |
|
48 | + passthru(($this->sudo ? 'sudo ' : '').$command); |
|
49 | 49 | } |
50 | 50 | } |
51 | 51 | $this->after(); |
@@ -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; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | public function getFull_name() |
35 | 35 | { |
36 | - return $this->getVendor() . '/' . $this->getName(); |
|
36 | + return $this->getVendor().'/'.$this->getName(); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | public function setFullName($value) |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function actionCreate() |
96 | 96 | { |
97 | - $res = $this->request('POST', '/orgs/' . $this->getVendor() . '/repos', [ |
|
97 | + $res = $this->request('POST', '/orgs/'.$this->getVendor().'/repos', [ |
|
98 | 98 | 'name' => $this->getName(), |
99 | 99 | 'description' => $this->getDescription(), |
100 | 100 | ]); |
@@ -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 | /** |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | return $wait; |
150 | 150 | } |
151 | 151 | |
152 | - return $this->request('POST', '/repos/' . $this->getFull_name() . '/releases', [ |
|
152 | + return $this->request('POST', '/repos/'.$this->getFull_name().'/releases', [ |
|
153 | 153 | 'tag_name' => $release, |
154 | 154 | 'name' => $release, |
155 | 155 | 'body' => $notes, |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | |
171 | 171 | public function request($method, $path, $data) |
172 | 172 | { |
173 | - $url = 'https://api.github.com' . $path; |
|
173 | + $url = 'https://api.github.com'.$path; |
|
174 | 174 | |
175 | - return $this->passthru('curl', ['-X', $method, '-H', 'Authorization: token ' . $this->getToken(), '--data', Json::encode($data), $url]); |
|
175 | + return $this->passthru('curl', ['-X', $method, '-H', 'Authorization: token '.$this->getToken(), '--data', Json::encode($data), $url]); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | public function findToken() |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $version->load(); |
30 | 30 | $version->setRelease($release); |
31 | 31 | $dir = dirname($version->getAbspath()); |
32 | - echo $version->renderFile() . PHP_EOL; |
|
32 | + echo $version->renderFile().PHP_EOL; |
|
33 | 33 | echo "(run from $dir)\n"; |
34 | 34 | } |
35 | 35 | |
@@ -44,6 +44,6 @@ discard block |
||
44 | 44 | |
45 | 45 | public function getComponent() |
46 | 46 | { |
47 | - return $this->take(($this->own ? 'own.' : '') . 'version'); |
|
47 | + return $this->take(($this->own ? 'own.' : '').'version'); |
|
48 | 48 | } |
49 | 49 | } |
@@ -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 |
@@ -26,7 +26,7 @@ |
||
26 | 26 | $type = isset($config['template']) || isset($config['copy']) ? 'File' : 'Directory'; |
27 | 27 | $defaults = [ |
28 | 28 | 'class' => "hidev\\components\\$type", |
29 | - 'path' => $this->_path . '/' . $id, |
|
29 | + 'path' => $this->_path.'/'.$id, |
|
30 | 30 | ]; |
31 | 31 | $config = array_merge($defaults, $config ?: []); |
32 | 32 | $object = Yii::createObject($config); |
@@ -144,11 +144,11 @@ |
||
144 | 144 | public function read($path, $asArray = false) |
145 | 145 | { |
146 | 146 | if (file_exists($path)) { |
147 | - Yii::info('Read file: ' . $path, 'file'); |
|
147 | + Yii::info('Read file: '.$path, 'file'); |
|
148 | 148 | |
149 | 149 | return $asArray ? file($path) : file_get_contents($path); |
150 | 150 | } else { |
151 | - Yii::warning('Couldn\'t read file: ' . $path, 'file'); |
|
151 | + Yii::warning('Couldn\'t read file: '.$path, 'file'); |
|
152 | 152 | |
153 | 153 | return; |
154 | 154 | } |
@@ -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 | { |
@@ -8,24 +8,24 @@ |
||
8 | 8 | * @copyright Copyright (c) 2015-2018, 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); |
@@ -27,7 +27,7 @@ |
||
27 | 27 | } catch (\Exception $e) { |
28 | 28 | throw new \RuntimeException("Failed to copy file \"{$data->getCopy()}\" to \"$path\": {$e->getMessage()}"); |
29 | 29 | } |
30 | - Yii::warning('Copied file: ' . $path); |
|
30 | + Yii::warning('Copied file: '.$path); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |