@@ -36,7 +36,7 @@ |
||
36 | 36 | foreach ($commands as $command) { |
37 | 37 | $command = trim($command); |
38 | 38 | if ($command) { |
39 | - passthru(($this->sudo ? 'sudo ' : '') . $command); |
|
39 | + passthru(($this->sudo ? 'sudo ' : '').$command); |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | } |
@@ -15,6 +15,6 @@ |
||
15 | 15 | { |
16 | 16 | public function modify($command) |
17 | 17 | { |
18 | - return 'sudo ' . $command; |
|
18 | + return 'sudo '.$command; |
|
19 | 19 | } |
20 | 20 | } |
@@ -10,8 +10,8 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | if (!defined('HIDEV_VENDOR_DIR')) { |
13 | - foreach ([dirname(dirname(__DIR__)) . '/vendor', dirname(dirname(dirname(dirname(__DIR__))))] as $dir) { |
|
14 | - if (file_exists($dir . '/autoload.php')) { |
|
13 | + foreach ([dirname(dirname(__DIR__)).'/vendor', dirname(dirname(dirname(dirname(__DIR__))))] as $dir) { |
|
14 | + if (file_exists($dir.'/autoload.php')) { |
|
15 | 15 | define('HIDEV_VENDOR_DIR', $dir); |
16 | 16 | break; |
17 | 17 | } |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | exit(1); |
23 | 23 | } |
24 | 24 | |
25 | - require HIDEV_VENDOR_DIR . '/autoload.php'; |
|
26 | - require HIDEV_VENDOR_DIR . '/yiisoft/yii2/Yii.php'; |
|
25 | + require HIDEV_VENDOR_DIR.'/autoload.php'; |
|
26 | + require HIDEV_VENDOR_DIR.'/yiisoft/yii2/Yii.php'; |
|
27 | 27 | |
28 | 28 | Yii::setAlias('@hidev', dirname(__DIR__)); |
29 | 29 | } |
@@ -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', |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | Yii::setAlias('@root', $this->getRootDir()); |
79 | 79 | $config = $this->takeConfig()->rawItem('package'); |
80 | 80 | $alias = strtr($config['namespace'], '\\', '/'); |
81 | - if ($alias && !Yii::getAlias('@' . $alias, false)) { |
|
82 | - $srcdir = Yii::getAlias('@root/' . ($config['src'] ?: 'src')); |
|
81 | + if ($alias && !Yii::getAlias('@'.$alias, false)) { |
|
82 | + $srcdir = Yii::getAlias('@root/'.($config['src'] ?: 'src')); |
|
83 | 83 | Yii::setAlias($alias, $srcdir); |
84 | 84 | } |
85 | 85 | } |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | protected function findRootDir() |
190 | 190 | { |
191 | 191 | $configDir = '.hidev'; |
192 | - for ($i = 0;$i < 9;++$i) { |
|
192 | + for ($i = 0; $i < 9; ++$i) { |
|
193 | 193 | if (is_dir($configDir)) { |
194 | 194 | return getcwd(); |
195 | 195 | } |
@@ -200,6 +200,6 @@ discard block |
||
200 | 200 | |
201 | 201 | public function buildRootPath($subpath) |
202 | 202 | { |
203 | - return $this->getRootDir() . DIRECTORY_SEPARATOR . $subpath; |
|
203 | + return $this->getRootDir().DIRECTORY_SEPARATOR.$subpath; |
|
204 | 204 | } |
205 | 205 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | public static function readExtraVendor($dir) |
66 | 66 | { |
67 | - return static::readExtraConfig($dir . '/hiqdev/hidev-config.php'); |
|
67 | + return static::readExtraConfig($dir.'/hiqdev/hidev-config.php'); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | public static function readExtraConfig($path) |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | foreach (['params', 'aliases', 'modules', 'components'] as $key) { |
98 | 98 | if (isset($config[$key])) { |
99 | - $this->{'setExtra' . ucfirst($key)}($config[$key]); |
|
99 | + $this->{'setExtra'.ucfirst($key)}($config[$key]); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | } |
@@ -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 | { |
@@ -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); |