@@ -55,7 +55,7 @@ |
||
| 55 | 55 | */ |
| 56 | 56 | public function setValue($value) |
| 57 | 57 | { |
| 58 | - if(!is_numeric($value)) |
|
| 58 | + if (!is_numeric($value)) |
|
| 59 | 59 | { |
| 60 | 60 | throw(new ArghException('IntegerParameter values must be numeric')); |
| 61 | 61 | } |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | */ |
| 137 | 137 | public function __isset(string $key): bool |
| 138 | 138 | { |
| 139 | - if( $this->parameters->exists($key) ) |
|
| 139 | + if ($this->parameters->exists($key)) |
|
| 140 | 140 | { |
| 141 | 141 | return TRUE; |
| 142 | 142 | } |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | $this->parameters = new ParameterCollection(); |
| 176 | 176 | |
| 177 | 177 | // Add Parameters to the ParameterCollection |
| 178 | - foreach($parameters as $p) |
|
| 178 | + foreach ($parameters as $p) |
|
| 179 | 179 | { |
| 180 | 180 | $this->parameters->addParameter($p); |
| 181 | 181 | } |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | // Merge Arguments into Parameters |
| 215 | 215 | $this->parameters->mergeArguments($arguments); |
| 216 | 216 | } |
| 217 | - catch(ArghException $e) |
|
| 217 | + catch (ArghException $e) |
|
| 218 | 218 | { |
| 219 | 219 | throw $e; |
| 220 | 220 | } |
@@ -234,11 +234,11 @@ discard block |
||
| 234 | 234 | * @return mixed The value of an element of the $argv array; or the entire $argv array (when param $i is null) |
| 235 | 235 | * @throws ArghException if $i is not a valid index of $argv |
| 236 | 236 | */ |
| 237 | - public function argv(int $i=null) |
|
| 237 | + public function argv(int $i = null) |
|
| 238 | 238 | { |
| 239 | - if($i !== null) |
|
| 239 | + if ($i !== null) |
|
| 240 | 240 | { |
| 241 | - if( array_key_exists($i, $this->argv) ) |
|
| 241 | + if (array_key_exists($i, $this->argv)) |
|
| 242 | 242 | { |
| 243 | 243 | return $this->argv[$i]; |
| 244 | 244 | } |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | { |
| 274 | 274 | |
| 275 | 275 | // Check the ParameterCollection for a Parameter with $key |
| 276 | - if( !$this->parameters->exists($key) ) |
|
| 276 | + if (!$this->parameters->exists($key)) |
|
| 277 | 277 | { |
| 278 | 278 | throw new ArghException(__CLASS__ . ': Parameter \'' . $key . '\' was not defined.'); |
| 279 | 279 | } |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | |
| 283 | 283 | //! TODO: Replace with Parameter::getValueOrDefault() |
| 284 | 284 | |
| 285 | - if( $this->parameters->get($key)->getValue() ) |
|
| 285 | + if ($this->parameters->get($key)->getValue()) |
|
| 286 | 286 | { |
| 287 | 287 | // Return the Parameters value |
| 288 | 288 | return $this->parameters->get($key)->getValue(); |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | */ |
| 313 | 313 | public function variables() |
| 314 | 314 | { |
| 315 | - if($this->parameters->hasVariable()) |
|
| 315 | + if ($this->parameters->hasVariable()) |
|
| 316 | 316 | { |
| 317 | 317 | return $this->parameters->get(Parameter::ARGH_NAME_VARIABLE)->getValue(); |
| 318 | 318 | } |
@@ -365,15 +365,15 @@ discard block |
||
| 365 | 365 | // TODO: Determine the longest value of each parameter attribute, to make pretty columns |
| 366 | 366 | |
| 367 | 367 | // Show Commands |
| 368 | - foreach($this->parameters->all() as $p) |
|
| 368 | + foreach ($this->parameters->all() as $p) |
|
| 369 | 369 | { |
| 370 | - if($p->getParameterType() == ARGH_TYPE_COMMAND) |
|
| 370 | + if ($p->getParameterType() == ARGH_TYPE_COMMAND) |
|
| 371 | 371 | { |
| 372 | 372 | $buff .= 'COMMANDS:' . "\n"; |
| 373 | 373 | |
| 374 | - if($p->hasOptions()) |
|
| 374 | + if ($p->hasOptions()) |
|
| 375 | 375 | { |
| 376 | - foreach($p->getOptions() as $o) |
|
| 376 | + foreach ($p->getOptions() as $o) |
|
| 377 | 377 | { |
| 378 | 378 | $buff .= $o . "\n"; |
| 379 | 379 | } // END: foreach($p->options() as $o) |
@@ -383,16 +383,16 @@ discard block |
||
| 383 | 383 | $buff .= "\n"; |
| 384 | 384 | |
| 385 | 385 | $buff .= 'OPTIONS:' . "\n"; |
| 386 | - foreach($this->parameters->all() as $p) |
|
| 386 | + foreach ($this->parameters->all() as $p) |
|
| 387 | 387 | { |
| 388 | - if( ($p->getParameterType() != ARGH_TYPE_COMMAND) && ($p->getParameterType() != ARGH_TYPE_VARIABLE) ) |
|
| 388 | + if (($p->getParameterType() != ARGH_TYPE_COMMAND) && ($p->getParameterType() != ARGH_TYPE_VARIABLE)) |
|
| 389 | 389 | { |
| 390 | 390 | $buff .= '-' . $p->getFlag() . "\t" . $p->getName() . "\t" . $p->getDescription(); |
| 391 | 391 | |
| 392 | - if($p->hasOptions()) |
|
| 392 | + if ($p->hasOptions()) |
|
| 393 | 393 | { |
| 394 | 394 | $buff .= "\t" . '['; |
| 395 | - foreach($p->getOptions() as $o) |
|
| 395 | + foreach ($p->getOptions() as $o) |
|
| 396 | 396 | { |
| 397 | 397 | $buff .= $o . ', '; |
| 398 | 398 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | public static function createWithAttributes(array $attributes) : Parameter |
| 65 | 65 | { |
| 66 | 66 | // Force VariableParameters to use a constant name |
| 67 | - if(array_key_exists('name', $attributes)) |
|
| 67 | + if (array_key_exists('name', $attributes)) |
|
| 68 | 68 | { |
| 69 | 69 | $attributes['name'] = Parameter::ARGH_NAME_VARIABLE; |
| 70 | 70 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | public function setValue($value) |
| 101 | 101 | { |
| 102 | 102 | echo "VariableParameter: setValue($value)" . PHP_EOL; |
| 103 | - if(is_array($value)) |
|
| 103 | + if (is_array($value)) |
|
| 104 | 104 | { |
| 105 | 105 | $this->value = $value; |
| 106 | 106 | } |
@@ -123,14 +123,14 @@ discard block |
||
| 123 | 123 | public function addValue($value) |
| 124 | 124 | { |
| 125 | 125 | // Check if this Parameter has a previously set value |
| 126 | - if($this->value === null) |
|
| 126 | + if ($this->value === null) |
|
| 127 | 127 | { |
| 128 | 128 | // Initialize this Parameters value to a new array |
| 129 | 129 | $this->value = array(); |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | // Check if the new value is an array |
| 133 | - if(!is_array($value)) |
|
| 133 | + if (!is_array($value)) |
|
| 134 | 134 | { |
| 135 | 135 | // Append new single value to this Parameters value array |
| 136 | 136 | $this->value[] = $value; |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | else |
| 139 | 139 | { |
| 140 | 140 | // Append every new value to this Parameters value array |
| 141 | - foreach($value as $v) $this->value[] = $v; |
|
| 141 | + foreach ($value as $v) $this->value[] = $v; |
|
| 142 | 142 | } |
| 143 | 143 | } |
| 144 | 144 | |
@@ -254,7 +254,7 @@ |
||
| 254 | 254 | // Create an array of Rules |
| 255 | 255 | $this->rules = array(); |
| 256 | 256 | } |
| 257 | - catch(Exception $e) |
|
| 257 | + catch (Exception $e) |
|
| 258 | 258 | { |
| 259 | 259 | throw($e); |
| 260 | 260 | } |