@@ -1,8 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | /** |
| 4 | - * VariableParameter.php |
|
| 5 | - */ |
|
| 4 | + * VariableParameter.php |
|
| 5 | + */ |
|
| 6 | 6 | |
| 7 | 7 | namespace netfocusinc\argh; |
| 8 | 8 | |
@@ -10,18 +10,18 @@ discard block |
||
| 10 | 10 | use netfocusinc\argh\Parameter; |
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | - * Variable parameter. |
|
| 14 | - * |
|
| 15 | - * Subtype of Parameter that represents an (unmarked) variable. |
|
| 16 | - * Variable Parameters are used to save unmakred input (naked variables) |
|
| 17 | - * Their value always consists of an array. |
|
| 18 | - * |
|
| 19 | - * @api |
|
| 20 | - * |
|
| 21 | - * @author Benjamin Hough |
|
| 22 | - * |
|
| 23 | - * @since 1.0.0 |
|
| 24 | - */ |
|
| 13 | + * Variable parameter. |
|
| 14 | + * |
|
| 15 | + * Subtype of Parameter that represents an (unmarked) variable. |
|
| 16 | + * Variable Parameters are used to save unmakred input (naked variables) |
|
| 17 | + * Their value always consists of an array. |
|
| 18 | + * |
|
| 19 | + * @api |
|
| 20 | + * |
|
| 21 | + * @author Benjamin Hough |
|
| 22 | + * |
|
| 23 | + * @since 1.0.0 |
|
| 24 | + */ |
|
| 25 | 25 | class VariableParameter extends Parameter |
| 26 | 26 | { |
| 27 | 27 | |
@@ -30,14 +30,14 @@ discard block |
||
| 30 | 30 | // |
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | - * Returns an instance of VariableParameter |
|
| 34 | - * |
|
| 35 | - * VariableParameters are always named with the ARGH_NAME_VARIABLE constant |
|
| 36 | - * |
|
| 37 | - * @since 1.0.1 |
|
| 38 | - * |
|
| 39 | - * @return Parameter |
|
| 40 | - */ |
|
| 33 | + * Returns an instance of VariableParameter |
|
| 34 | + * |
|
| 35 | + * VariableParameters are always named with the ARGH_NAME_VARIABLE constant |
|
| 36 | + * |
|
| 37 | + * @since 1.0.1 |
|
| 38 | + * |
|
| 39 | + * @return Parameter |
|
| 40 | + */ |
|
| 41 | 41 | public static function create() : Parameter |
| 42 | 42 | { |
| 43 | 43 | return parent::createWithAttributes( |
@@ -50,17 +50,17 @@ discard block |
||
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | - * Returns an instance of VariableParameter |
|
| 54 | - * |
|
| 55 | - * Overriding Parameter::createWithAttribute() here prevents this from being called with a custom 'name' attribute |
|
| 56 | - * VariableParameters need to be named with ARGH_NAME_VARIABLE constant; Argh uses this 'name' to find variables |
|
| 57 | - * |
|
| 58 | - * @since 1.0.2 |
|
| 59 | - * |
|
| 60 | - * @param array $attributes |
|
| 61 | - * |
|
| 62 | - * @return Parameter |
|
| 63 | - */ |
|
| 53 | + * Returns an instance of VariableParameter |
|
| 54 | + * |
|
| 55 | + * Overriding Parameter::createWithAttribute() here prevents this from being called with a custom 'name' attribute |
|
| 56 | + * VariableParameters need to be named with ARGH_NAME_VARIABLE constant; Argh uses this 'name' to find variables |
|
| 57 | + * |
|
| 58 | + * @since 1.0.2 |
|
| 59 | + * |
|
| 60 | + * @param array $attributes |
|
| 61 | + * |
|
| 62 | + * @return Parameter |
|
| 63 | + */ |
|
| 64 | 64 | public static function createWithAttributes(array $attributes) : Parameter |
| 65 | 65 | { |
| 66 | 66 | // Force VariableParameters to use a constant name |
@@ -77,26 +77,26 @@ discard block |
||
| 77 | 77 | // |
| 78 | 78 | |
| 79 | 79 | /** |
| 80 | - * Returns ARGH_TYPE_VARIABLE |
|
| 81 | - * |
|
| 82 | - * @since 1.0.0 |
|
| 83 | - * |
|
| 84 | - * @return int |
|
| 85 | - */ |
|
| 80 | + * Returns ARGH_TYPE_VARIABLE |
|
| 81 | + * |
|
| 82 | + * @since 1.0.0 |
|
| 83 | + * |
|
| 84 | + * @return int |
|
| 85 | + */ |
|
| 86 | 86 | public function getParameterType(): int |
| 87 | 87 | { |
| 88 | 88 | return Parameter::ARGH_TYPE_VARIABLE; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | /** |
| 92 | - * Sets the array value of this Parameter. |
|
| 93 | - * |
|
| 94 | - * Forces all values into an array |
|
| 95 | - * |
|
| 96 | - * @since 1.0.0 |
|
| 97 | - * |
|
| 98 | - * @param mixed $value |
|
| 99 | - */ |
|
| 92 | + * Sets the array value of this Parameter. |
|
| 93 | + * |
|
| 94 | + * Forces all values into an array |
|
| 95 | + * |
|
| 96 | + * @since 1.0.0 |
|
| 97 | + * |
|
| 98 | + * @param mixed $value |
|
| 99 | + */ |
|
| 100 | 100 | public function setValue($value) |
| 101 | 101 | { |
| 102 | 102 | if(is_array($value)) |
@@ -110,15 +110,15 @@ discard block |
||
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | /** |
| 113 | - * Adds an element to the value of this Parameter |
|
| 114 | - * |
|
| 115 | - * Forces all values into an array |
|
| 116 | - * |
|
| 117 | - * @since 1.0.0 |
|
| 118 | - * |
|
| 119 | - * @param mixed $value |
|
| 120 | - * |
|
| 121 | - */ |
|
| 113 | + * Adds an element to the value of this Parameter |
|
| 114 | + * |
|
| 115 | + * Forces all values into an array |
|
| 116 | + * |
|
| 117 | + * @since 1.0.0 |
|
| 118 | + * |
|
| 119 | + * @param mixed $value |
|
| 120 | + * |
|
| 121 | + */ |
|
| 122 | 122 | public function addValue($value) |
| 123 | 123 | { |
| 124 | 124 | // Check if this Parameter has a previously set value |
@@ -1,51 +1,51 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | /** |
| 4 | - * ArghException.php |
|
| 5 | - */ |
|
| 4 | + * ArghException.php |
|
| 5 | + */ |
|
| 6 | 6 | |
| 7 | 7 | namespace netfocusinc\argh; |
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | - * An exception that is thrown by Argh |
|
| 11 | - * |
|
| 12 | - * A subclass of Exception that is thrown by Argh. |
|
| 13 | - * |
|
| 14 | - * @author Benjamin Hough |
|
| 15 | - * |
|
| 16 | - * @since 1.0.0 |
|
| 17 | - * |
|
| 18 | - */ |
|
| 10 | + * An exception that is thrown by Argh |
|
| 11 | + * |
|
| 12 | + * A subclass of Exception that is thrown by Argh. |
|
| 13 | + * |
|
| 14 | + * @author Benjamin Hough |
|
| 15 | + * |
|
| 16 | + * @since 1.0.0 |
|
| 17 | + * |
|
| 18 | + */ |
|
| 19 | 19 | class ArghException extends \Exception |
| 20 | 20 | { |
| 21 | 21 | /** |
| 22 | - * Contruct a new ArghException with a required message |
|
| 23 | - * |
|
| 24 | - * @since 1.0.0 |
|
| 25 | - * |
|
| 26 | - * @param string $message Custom message describing this Exception |
|
| 27 | - * @param int $code Custom error code |
|
| 28 | - * @param Exception $previous The previous Exception to occurr |
|
| 29 | - * |
|
| 30 | - */ |
|
| 31 | - public function __construct($message, $code = 0, \Exception $previous = null) { |
|
| 32 | - // some code |
|
| 22 | + * Contruct a new ArghException with a required message |
|
| 23 | + * |
|
| 24 | + * @since 1.0.0 |
|
| 25 | + * |
|
| 26 | + * @param string $message Custom message describing this Exception |
|
| 27 | + * @param int $code Custom error code |
|
| 28 | + * @param Exception $previous The previous Exception to occurr |
|
| 29 | + * |
|
| 30 | + */ |
|
| 31 | + public function __construct($message, $code = 0, \Exception $previous = null) { |
|
| 32 | + // some code |
|
| 33 | 33 | |
| 34 | - // make sure everything is assigned properly |
|
| 35 | - parent::__construct($message, $code, $previous); |
|
| 36 | - } |
|
| 34 | + // make sure everything is assigned properly |
|
| 35 | + parent::__construct($message, $code, $previous); |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | - * Returns a descriptive string indentifying this Exception |
|
| 41 | - * |
|
| 42 | - * @since 1.0.0 |
|
| 43 | - * |
|
| 44 | - * @return string |
|
| 45 | - * |
|
| 46 | - */ |
|
| 47 | - public function __toString() { |
|
| 48 | - return __CLASS__ . ": [{$this->code}]: {$this->message}\n"; |
|
| 49 | - } |
|
| 40 | + * Returns a descriptive string indentifying this Exception |
|
| 41 | + * |
|
| 42 | + * @since 1.0.0 |
|
| 43 | + * |
|
| 44 | + * @return string |
|
| 45 | + * |
|
| 46 | + */ |
|
| 47 | + public function __toString() { |
|
| 48 | + return __CLASS__ . ": [{$this->code}]: {$this->message}\n"; |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | 51 | } |
| 52 | 52 | \ No newline at end of file |