@@ -81,7 +81,7 @@ |
||
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | // Add string and end coloring |
| 84 | - $colored_string .= $string . "\033[0m"; |
|
| 84 | + $colored_string .= $string . "\033[0m"; |
|
| 85 | 85 | |
| 86 | 86 | return $colored_string; |
| 87 | 87 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | public function __construct(string $cmd) { |
| 55 | 55 | $this->cmd = $cmd; |
| 56 | - if($cmd !== 'help') { |
|
| 56 | + if ($cmd !== 'help') { |
|
| 57 | 57 | $this->addSubCmd( |
| 58 | 58 | self::extend('help') |
| 59 | 59 | ->setCallable(static function(Cmd $cmd) { |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | try { |
| 88 | 88 | $is_valid = $this->validateCallable($callable); |
| 89 | - if($is_valid) { |
|
| 89 | + if ($is_valid) { |
|
| 90 | 90 | $this->callable = $callable; |
| 91 | 91 | |
| 92 | 92 | } |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | $cmd = $this; |
| 114 | 114 | $pwd = []; |
| 115 | 115 | |
| 116 | - while($cmd !== null) { |
|
| 116 | + while ($cmd !== null) { |
|
| 117 | 117 | $pwd[] = $cmd->parent !== null ? $cmd->cmd : 'cmd'; |
| 118 | 118 | $cmd = $cmd->parent; |
| 119 | 119 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | $pwd = array_reverse($pwd); |
| 122 | 122 | |
| 123 | 123 | $pwd_str = ''; |
| 124 | - foreach($pwd as $p) { |
|
| 124 | + foreach ($pwd as $p) { |
|
| 125 | 125 | $pwd_str .= ucfirst(strtolower($p)); |
| 126 | 126 | } |
| 127 | 127 | |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | |
| 153 | 153 | echo $eol; |
| 154 | 154 | |
| 155 | - if(!empty($this->params)) { |
|
| 155 | + if (!empty($this->params)) { |
|
| 156 | 156 | |
| 157 | 157 | echo $eol; |
| 158 | 158 | echo 'Parameters: ' . $eol; |
@@ -182,19 +182,19 @@ discard block |
||
| 182 | 182 | $check = new ReflectionFunction($callable); |
| 183 | 183 | $parameters = $check->getParameters(); |
| 184 | 184 | |
| 185 | - if(count($parameters) !== 1) { |
|
| 185 | + if (count($parameters) !== 1) { |
|
| 186 | 186 | throw new RuntimeException('Invalid number of Parameters. Should be 1.'); |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | $type = $parameters[0]->getType(); |
| 190 | 190 | |
| 191 | - if($type === null) { |
|
| 191 | + if ($type === null) { |
|
| 192 | 192 | throw new RuntimeException('Named type of Parameter 1 should be "' . __CLASS__ . '".'); |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | $tname = $type->getName(); |
| 196 | 196 | |
| 197 | - if($tname !== __CLASS__) { |
|
| 197 | + if ($tname !== __CLASS__) { |
|
| 198 | 198 | throw new RuntimeException('Named type of Parameter 1 should be "' . __CLASS__ . '".'); |
| 199 | 199 | } |
| 200 | 200 | |
@@ -44,10 +44,10 @@ |
||
| 44 | 44 | |
| 45 | 45 | $disp = number_format($perc * 100); |
| 46 | 46 | |
| 47 | - $status_bar_percent = str_pad("$disp%", 5 , ' ', STR_PAD_LEFT); |
|
| 47 | + $status_bar_percent = str_pad("$disp%", 5, ' ', STR_PAD_LEFT); |
|
| 48 | 48 | $status_bar .= Color::getColoredString($status_bar_percent, Color::FOREGROUND_COLOR_GREEN); |
| 49 | 49 | |
| 50 | - $status_bar_done = " $done/$total"; |
|
| 50 | + $status_bar_done = " $done/$total"; |
|
| 51 | 51 | |
| 52 | 52 | $status_bar .= Color::getColoredString($status_bar_done, Color::FOREGROUND_COLOR_YELLOW); |
| 53 | 53 | |
@@ -22,14 +22,14 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | $callable = $cmd->getCallable(); |
| 24 | 24 | |
| 25 | - if($callable !== null) { |
|
| 25 | + if ($callable !== null) { |
|
| 26 | 26 | $callable($cmd); |
| 27 | 27 | return; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | $methodName = $cmd->getMethodName(); |
| 31 | 31 | |
| 32 | - if(method_exists($app, $methodName)) { |
|
| 32 | + if (method_exists($app, $methodName)) { |
|
| 33 | 33 | $app->$methodName($cmd); |
| 34 | 34 | return; |
| 35 | 35 | } |
@@ -115,10 +115,10 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | foreach ($params as $k => $v) { |
| 117 | 117 | $opt = $specs->add($k, $v['description']); |
| 118 | - if(array_key_exists('isa', $v)){ |
|
| 118 | + if (array_key_exists('isa', $v)) { |
|
| 119 | 119 | $opt->isa($v['isa']); |
| 120 | 120 | } |
| 121 | - if(array_key_exists('default', $v)){ |
|
| 121 | + if (array_key_exists('default', $v)) { |
|
| 122 | 122 | $opt->defaultValue($v['default']); |
| 123 | 123 | } |
| 124 | 124 | } |