@@ -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 | { |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | public static function readExtraVendor($dir) |
72 | 72 | { |
73 | - return static::readExtraConfig($dir . '/hiqdev/config/hidev.php'); |
|
73 | + return static::readExtraConfig($dir.'/hiqdev/config/hidev.php'); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | public static function readExtraConfig($path) |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | |
106 | 106 | foreach (['params', 'aliases', 'modules', 'components'] as $key) { |
107 | 107 | if (isset($config[$key])) { |
108 | - $this->{'setExtra' . ucfirst($key)}($config[$key]); |
|
108 | + $this->{'setExtra'.ucfirst($key)}($config[$key]); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 |
@@ -14,7 +14,7 @@ |
||
14 | 14 | 'name' => 'HiDev', |
15 | 15 | 'basePath' => dirname(__DIR__), |
16 | 16 | 'vendorPath' => HIDEV_VENDOR_DIR, |
17 | - 'runtimePath' => substr(__DIR__, 0, 7) === 'phar://' ? dirname($_SERVER['SCRIPT_NAME']) : dirname(HIDEV_VENDOR_DIR) . '/runtime', |
|
17 | + 'runtimePath' => substr(__DIR__, 0, 7) === 'phar://' ? dirname($_SERVER['SCRIPT_NAME']) : dirname(HIDEV_VENDOR_DIR).'/runtime', |
|
18 | 18 | 'enableCoreCommands' => false, |
19 | 19 | 'controllerNamespace' => 'hidev\\controllers', |
20 | 20 | 'defaultRoute' => 'default', |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | if (!is_file($path) || file_get_contents($path) !== $content) { |
33 | 33 | static::mkdir(dirname($path)); |
34 | 34 | file_put_contents($path, $content); |
35 | - Yii::warning('Written file: ' . $path, 'file'); |
|
35 | + Yii::warning('Written file: '.$path, 'file'); |
|
36 | 36 | |
37 | 37 | return true; |
38 | 38 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $path = rtrim(trim($path), '/'); |
53 | 53 | if (!file_exists($path)) { |
54 | 54 | mkdir($path, 0777, true); |
55 | - Yii::warning('Created dir: ' . $path . '/', 'file'); |
|
55 | + Yii::warning('Created dir: '.$path.'/', 'file'); |
|
56 | 56 | |
57 | 57 | return true; |
58 | 58 | } |
@@ -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 |
@@ -70,16 +70,16 @@ |
||
70 | 70 | { |
71 | 71 | $path = parent::detectCommand($path); |
72 | 72 | |
73 | - return is_executable($path) ? $path : '/usr/bin/env python ' . $path; |
|
73 | + return is_executable($path) ? $path : '/usr/bin/env python '.$path; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | public function install() |
77 | 77 | { |
78 | 78 | if ($this->installer) { |
79 | - passthru('/usr/bin/env wget ' . escapeshellarg($this->installer) . ' -O- | /usr/bin/env python', $exitcode); |
|
79 | + passthru('/usr/bin/env wget '.escapeshellarg($this->installer).' -O- | /usr/bin/env python', $exitcode); |
|
80 | 80 | } elseif ($this->download) { |
81 | - $dest = Yii::getAlias('@root/' . $this->name, false); |
|
82 | - passthru('/usr/bin/env wget ' . escapeshellarg($this->download) . ' -O ' . $dest, $exitcode); |
|
81 | + $dest = Yii::getAlias('@root/'.$this->name, false); |
|
82 | + passthru('/usr/bin/env wget '.escapeshellarg($this->download).' -O '.$dest, $exitcode); |
|
83 | 83 | } else { |
84 | 84 | passthru("/usr/bin/pip install {$this->package}", $exitcode); |
85 | 85 | } |