Passed
Push — master ( 86c8f0...871627 )
by Benjamin
03:46
created
src/netfocusinc/argh/CommandParameter.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -1,27 +1,27 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 /**
4
-	* CommandParameter.php
5
-	*/
4
+ * CommandParameter.php
5
+ */
6 6
 	
7 7
 namespace netfocusinc\argh;
8 8
 
9 9
 use netfocusinc\argh\Parameter;
10 10
 
11 11
 /**
12
-	* A Command Parameter.
13
-	*
14
-	* Subtype of Parameter that represents a command string
15
-	* Command parameters must define an array of 'options'.
16
-	* When interpreting command line arguments, commands will only be matched with command line input
17
-	* when the command line argument matches one of the pre-defined 'options'.
18
-	*
19
-	* @author Benjamin Hough
20
-	*
21
-	* @api
22
-	*
23
-	* @since 1.0.0
24
-	*/
12
+ * A Command Parameter.
13
+ *
14
+ * Subtype of Parameter that represents a command string
15
+ * Command parameters must define an array of 'options'.
16
+ * When interpreting command line arguments, commands will only be matched with command line input
17
+ * when the command line argument matches one of the pre-defined 'options'.
18
+ *
19
+ * @author Benjamin Hough
20
+ *
21
+ * @api
22
+ *
23
+ * @since 1.0.0
24
+ */
25 25
 class CommandParameter extends Parameter
26 26
 {
27 27
 	
@@ -35,19 +35,19 @@  discard block
 block discarded – undo
35 35
 	//
36 36
 	
37 37
 	/**
38
-		* Construct a new CommandParameter.
39
-		*
40
-		* Overrides Parameter constructor to enforce required 'options'
41
-		*
42
-		* @since 1.0.0
43
-		*
44
-		* @param string $name
45
-		* @param string $flag
46
-		* @param bool $required
47
-		* @param string $default The default 'option' to use for this command, when none is specified on the command line
48
-		* @param string $description
49
-		* @param array $options
50
-		*/
38
+	 * Construct a new CommandParameter.
39
+	 *
40
+	 * Overrides Parameter constructor to enforce required 'options'
41
+	 *
42
+	 * @since 1.0.0
43
+	 *
44
+	 * @param string $name
45
+	 * @param string $flag
46
+	 * @param bool $required
47
+	 * @param string $default The default 'option' to use for this command, when none is specified on the command line
48
+	 * @param string $description
49
+	 * @param array $options
50
+	 */
51 51
 		
52 52
 	public function __construct(string $name, string $flag=null, bool $required=FALSE, $default=null, string $description=null, array $options=array())
53 53
 	{
@@ -63,28 +63,28 @@  discard block
 block discarded – undo
63 63
 	}
64 64
 	
65 65
 	/**
66
-		* Returns ARGH_TYPE_COMMAND
67
-		*
68
-		* @since 1.0.0
69
-		*
70
-		* @return int
71
-		*/
66
+	 * Returns ARGH_TYPE_COMMAND
67
+	 *
68
+	 * @since 1.0.0
69
+	 *
70
+	 * @return int
71
+	 */
72 72
 	public function getParameterType(): int
73 73
 	{
74 74
 		return Parameter::ARGH_TYPE_COMMAND;
75 75
 	}
76 76
 
77 77
 	/**
78
-		* Sets the string value of this Parameter.
79
-		*
80
-		* Checks that the given 'value' matches one of this Commands 'options' before settings its value.
81
-		*
82
-		* @since 1.0.0
83
-		*
84
-		* @param string $value
85
-		*
86
-		* @throws ArghException When $value is not one of this CommandsParameter's 'options'
87
-		*/
78
+	 * Sets the string value of this Parameter.
79
+	 *
80
+	 * Checks that the given 'value' matches one of this Commands 'options' before settings its value.
81
+	 *
82
+	 * @since 1.0.0
83
+	 *
84
+	 * @param string $value
85
+	 *
86
+	 * @throws ArghException When $value is not one of this CommandsParameter's 'options'
87
+	 */
88 88
 	public function setValue($value)
89 89
 	{		
90 90
 		if(is_array($value))
Please login to merge, or discard this patch.
src/netfocusinc/argh/StringParameter.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 /**
4
-	* StringParameter.php
5
-	*/
4
+ * StringParameter.php
5
+ */
6 6
 	
7 7
 namespace netfocusinc\argh;
8 8
 
@@ -11,16 +11,16 @@  discard block
 block discarded – undo
11 11
 
12 12
 
13 13
 /**
14
-	* String parameter
15
-	*
16
-	* Subtype of Parameter that represents a string value.
17
-	*
18
-	* @api
19
-	*
20
-	* @author Benjamin Hough
21
-	*
22
-	* @since 1.0.0
23
-	*/
14
+ * String parameter
15
+ *
16
+ * Subtype of Parameter that represents a string value.
17
+ *
18
+ * @api
19
+ *
20
+ * @author Benjamin Hough
21
+ *
22
+ * @since 1.0.0
23
+ */
24 24
 class StringParameter extends Parameter
25 25
 {
26 26
 	
@@ -33,28 +33,28 @@  discard block
 block discarded – undo
33 33
 	//
34 34
 	
35 35
 	/**
36
-		* Returns ARGH_TYPE_STRING
37
-		*
38
-		* @since 1.0.0
39
-		*
40
-		* @return int
41
-		*/
36
+	 * Returns ARGH_TYPE_STRING
37
+	 *
38
+	 * @since 1.0.0
39
+	 *
40
+	 * @return int
41
+	 */
42 42
 	public function getParameterType(): int
43 43
 	{
44 44
 		return Parameter::ARGH_TYPE_STRING;
45 45
 	}
46 46
 
47 47
 	/**
48
-		* Sets the string value of this Parameter.
49
-		*
50
-		* Casts all values to string.
51
-		*
52
-		* @since 1.0.0
53
-		*
54
-		* @param mixed $value
55
-		*
56
-		* @throws ArghExpception If $value is an array.
57
-		*/
48
+	 * Sets the string value of this Parameter.
49
+	 *
50
+	 * Casts all values to string.
51
+	 *
52
+	 * @since 1.0.0
53
+	 *
54
+	 * @param mixed $value
55
+	 *
56
+	 * @throws ArghExpception If $value is an array.
57
+	 */
58 58
 	public function setValue($value)
59 59
 	{		
60 60
 		if(is_array($value))
Please login to merge, or discard this patch.
src/netfocusinc/argh/ArgumentParser.php 1 patch
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 	
3 3
 /**
4
-	* ArgumentParser.php
5
-	*/
4
+ * ArgumentParser.php
5
+ */
6 6
 	
7 7
 namespace netfocusinc\argh;
8 8
 
9 9
 /**
10
-	* Internal class that performs the work of parsing command line arguments.
11
-	*
12
-	* Uses the provided Language and ParameterCollection to interpret an array of command line arguments.
13
-	*
14
-	* @author Benjamin Hough
15
-	*
16
-	* @internal
17
-	*
18
-	* @since 1.0.0
19
-	*/
10
+ * Internal class that performs the work of parsing command line arguments.
11
+ *
12
+ * Uses the provided Language and ParameterCollection to interpret an array of command line arguments.
13
+ *
14
+ * @author Benjamin Hough
15
+ *
16
+ * @internal
17
+ *
18
+ * @since 1.0.0
19
+ */
20 20
 class ArgumentParser
21 21
 {
22 22
 	
@@ -35,13 +35,13 @@  discard block
 block discarded – undo
35 35
 	//
36 36
 	
37 37
 	/**
38
-		* Constructs a new ArgumentParser
39
-		*
40
-		* Creates a new ArgumentParser instance with the specified Langugage and ParameterCollection
41
-		* The resulting instance is ready for parsing an array of arguments.
42
-		*
43
-		* @since 1.0.0
44
-		*/
38
+	 * Constructs a new ArgumentParser
39
+	 *
40
+	 * Creates a new ArgumentParser instance with the specified Langugage and ParameterCollection
41
+	 * The resulting instance is ready for parsing an array of arguments.
42
+	 *
43
+	 * @since 1.0.0
44
+	 */
45 45
 	public function __construct(Language $language, ParameterCollection $parameterCollection)
46 46
 	{
47 47
 		// Init properties on this instance
@@ -51,18 +51,18 @@  discard block
 block discarded – undo
51 51
 	
52 52
 		
53 53
 	/**
54
-		* Parse an array of command line arguments.
55
-		*
56
-		* Interprets an array of command line arguments using the Language and ParameterCollection
57
-		* that was configured during construction.
58
-		* When successful, this results in an array of Arguments (with key,value pairs).
59
-		*
60
-		* @param array $args A pre-processed $argv array
61
-		*
62
-		* @return Argument[]
63
-		*
64
-		* @throws ArgumentException
65
-		*/
54
+	 * Parse an array of command line arguments.
55
+	 *
56
+	 * Interprets an array of command line arguments using the Language and ParameterCollection
57
+	 * that was configured during construction.
58
+	 * When successful, this results in an array of Arguments (with key,value pairs).
59
+	 *
60
+	 * @param array $args A pre-processed $argv array
61
+	 *
62
+	 * @return Argument[]
63
+	 *
64
+	 * @throws ArgumentException
65
+	 */
66 66
 	public function parse(array $args): array
67 67
 	{
68 68
 		// Init an array of Arguments
@@ -221,21 +221,21 @@  discard block
 block discarded – undo
221 221
 	} // END: public static function parse()
222 222
 	
223 223
 	/**
224
-		* Attempts to create Arguments given a Rule and matching tokens (from the command line arguments string)
225
-		*
226
-		* When a set of matching tokens (from a command line argument string) is matched with a Rule (by the parse method)
227
-		* This function is used to determine if the matching tokens can yield an Argument from the matched Rule.
228
-		* This requires checking that the SEMANTICS of the Rule correspond with the matched tokens
229
-		* For example, if -xvf matches the Rule (hypenated multi flag), each character (of xvf) must also correspond to the flag of a 
230
-		* Parameter that was defined by the client. When no Argument is yielded, the parser can then attempt to match the tokens with another Rule.
231
-		*
232
-		* @internal
233
-		*
234
-		* @param $rule Rule
235
-		* @param $tokens string[]
236
-		*
237
-		* @return Argument[] An array of Arguments
238
-		*/
224
+	 * Attempts to create Arguments given a Rule and matching tokens (from the command line arguments string)
225
+	 *
226
+	 * When a set of matching tokens (from a command line argument string) is matched with a Rule (by the parse method)
227
+	 * This function is used to determine if the matching tokens can yield an Argument from the matched Rule.
228
+	 * This requires checking that the SEMANTICS of the Rule correspond with the matched tokens
229
+	 * For example, if -xvf matches the Rule (hypenated multi flag), each character (of xvf) must also correspond to the flag of a 
230
+	 * Parameter that was defined by the client. When no Argument is yielded, the parser can then attempt to match the tokens with another Rule.
231
+	 *
232
+	 * @internal
233
+	 *
234
+	 * @param $rule Rule
235
+	 * @param $tokens string[]
236
+	 *
237
+	 * @return Argument[] An array of Arguments
238
+	 */
239 239
 	public function yieldArgumentsFromRule(Rule $rule, array $tokens): array
240 240
 	{
241 241
 		
Please login to merge, or discard this patch.
src/netfocusinc/argh/Rule.php 1 patch
Indentation   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 	
3 3
 /**
4
-	* Rule.php
5
-	*/
4
+ * Rule.php
5
+ */
6 6
 	
7 7
 namespace netfocusinc\argh;
8 8
 
9 9
 /**
10
-	* Representation of a Rule used to interpret command line arguments
11
-	*
12
-	* Rules are a combination of syntax and semantics used to interpret command line arguments.
13
-	* When a command line string matches the syntax of a rule, and its character content matches the sematics of the rule
14
-	* this command line string can be used to create an Argument.
15
-	*
16
-	* @author Benjamin Hough
17
-	*
18
-	* @since 1.0.0
19
-	*/
10
+ * Representation of a Rule used to interpret command line arguments
11
+ *
12
+ * Rules are a combination of syntax and semantics used to interpret command line arguments.
13
+ * When a command line string matches the syntax of a rule, and its character content matches the sematics of the rule
14
+ * this command line string can be used to create an Argument.
15
+ *
16
+ * @author Benjamin Hough
17
+ *
18
+ * @since 1.0.0
19
+ */
20 20
 class Rule
21 21
 {
22 22
 	//
@@ -64,14 +64,14 @@  discard block
 block discarded – undo
64 64
 	//
65 65
 	
66 66
 	/**
67
-		* Creates a new Rule with the specified $attributes
68
-		*
69
-		* Convenience method for creating new Rules with the specified $attributes
70
-		*
71
-		* @since 1.0.0
72
-		*
73
-		* @returns Rule
74
-		*/
67
+	 * Creates a new Rule with the specified $attributes
68
+	 *
69
+	 * Convenience method for creating new Rules with the specified $attributes
70
+	 *
71
+	 * @since 1.0.0
72
+	 *
73
+	 * @returns Rule
74
+	 */
75 75
 	public static function createWithAttributes(array $attributes): Rule
76 76
 	{
77 77
 		// Defaults
@@ -90,14 +90,14 @@  discard block
 block discarded – undo
90 90
 	}
91 91
 	
92 92
 	/**
93
-		* Returns a (human friendly) string representation of a semantic int
94
-		*
95
-		* @since 1.0.0
96
-		*
97
-		* @param int $semantics
98
-		*
99
-		* @returns string
100
-		*/
93
+	 * Returns a (human friendly) string representation of a semantic int
94
+	 *
95
+	 * @since 1.0.0
96
+	 *
97
+	 * @param int $semantics
98
+	 *
99
+	 * @returns string
100
+	 */
101 101
 	public static function semanticsToString(int $semantics)
102 102
 	{
103 103
 		switch($semantics)
@@ -118,19 +118,19 @@  discard block
 block discarded – undo
118 118
 	//
119 119
 	
120 120
 	/**
121
-		* Rule contructor.
122
-		*
123
-		* Constructs a new Rule.
124
-		*
125
-		* @since 1.0.0
126
-		*
127
-		* @param string $name
128
-		* @param string $example
129
-		* @param string $syntax
130
-		* @param array $semantics
131
-		*
132
-		* @throws ArghException
133
-		*/
121
+	 * Rule contructor.
122
+	 *
123
+	 * Constructs a new Rule.
124
+	 *
125
+	 * @since 1.0.0
126
+	 *
127
+	 * @param string $name
128
+	 * @param string $example
129
+	 * @param string $syntax
130
+	 * @param array $semantics
131
+	 *
132
+	 * @throws ArghException
133
+	 */
134 134
 	public function __construct(string $name, string $example, string $syntax, array $semantics)
135 135
 	{
136 136
 		
@@ -155,53 +155,53 @@  discard block
 block discarded – undo
155 155
 	}
156 156
 
157 157
 	/**
158
-		* Gets the 'name' property of this Rule
159
-		*
160
-		* @since 1.0.0
161
-		*
162
-		* @return string
163
-	*/
158
+	 * Gets the 'name' property of this Rule
159
+	 *
160
+	 * @since 1.0.0
161
+	 *
162
+	 * @return string
163
+	 */
164 164
 	public function name(): string { return $this->name; }
165 165
 
166 166
 	/**
167
-		* Gets the 'syntax' property of this Rule
168
-		*
169
-		* @since 1.0.0
170
-		*
171
-		* @return string
172
-	*/
167
+	 * Gets the 'syntax' property of this Rule
168
+	 *
169
+	 * @since 1.0.0
170
+	 *
171
+	 * @return string
172
+	 */
173 173
 	public function syntax(): string { return $this->syntax; }
174 174
 	
175 175
 	/**
176
-		* Gets the 'semantics' property of this Rule
177
-		*
178
-		* @since 1.0.0
179
-		*
180
-		* @return array
181
-	*/
176
+	 * Gets the 'semantics' property of this Rule
177
+	 *
178
+	 * @since 1.0.0
179
+	 *
180
+	 * @return array
181
+	 */
182 182
 	public function semantics(): array { return $this->semantics; }
183 183
 	
184 184
 	/**
185
-		* Gets the 'sample' of this Rule
186
-		*
187
-		* @since 1.0.0
188
-		*
189
-		* @return string
190
-	*/
185
+	 * Gets the 'sample' of this Rule
186
+	 *
187
+	 * @since 1.0.0
188
+	 *
189
+	 * @return string
190
+	 */
191 191
 	public function example(): string { return $this->example; }
192 192
 
193 193
 	/**
194
-		* Does this Rule match a $string
195
-		*
196
-		* Note that matching a Rule does not guarantee the Rule will result
197
-		* in a new Argument. Ultimately, the argument string may not meet all the 
198
-		* requirements of the Rule, e.g. matching defined parameter name|flag|options
199
-		*
200
-		* @param $string string A string to check for match with this Rule
201
-		* @param $tokens array Reference to an array, on match will contain matching elements
202
-		*
203
-		* @return bool
204
-	  */	
194
+	 * Does this Rule match a $string
195
+	 *
196
+	 * Note that matching a Rule does not guarantee the Rule will result
197
+	 * in a new Argument. Ultimately, the argument string may not meet all the 
198
+	 * requirements of the Rule, e.g. matching defined parameter name|flag|options
199
+	 *
200
+	 * @param $string string A string to check for match with this Rule
201
+	 * @param $tokens array Reference to an array, on match will contain matching elements
202
+	 *
203
+	 * @return bool
204
+	 */	
205 205
 	public function match($string, &$tokens=array()): bool
206 206
 	{
207 207
 		if( preg_match($this->syntax(), $string, $tokens) )
Please login to merge, or discard this patch.
src/netfocusinc/argh/ArgvPreprocessor.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,20 +1,20 @@
 block discarded – undo
1 1
 <?php
2 2
 	
3 3
 /**
4
-	* ArgvPreprocessor.php
5
-	*/
4
+ * ArgvPreprocessor.php
5
+ */
6 6
 	
7 7
 namespace netfocusinc\argh;
8 8
 
9 9
 /**
10
-	* Handles the preparation of PHP $argv arrays that is required before parsing
11
-	*
12
-	* @author Benjamin Hough
13
-	*
14
-	* @internal
15
-	*
16
-	* @since 1.0.0
17
-	*/
10
+ * Handles the preparation of PHP $argv arrays that is required before parsing
11
+ *
12
+ * @author Benjamin Hough
13
+ *
14
+ * @internal
15
+ *
16
+ * @since 1.0.0
17
+ */
18 18
 class ArgvPreprocessor
19 19
 {
20 20
 	
Please login to merge, or discard this patch.
src/netfocusinc/argh/ParameterCollection.php 1 patch
Indentation   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 /**
4
-	* ParameterCollection.php
5
-	*/
4
+ * ParameterCollection.php
5
+ */
6 6
 		
7 7
 namespace netfocusinc\argh;
8 8
 
@@ -10,19 +10,19 @@  discard block
 block discarded – undo
10 10
 use netfocusinc\argh\Parameter;
11 11
 
12 12
 /**
13
-	* Representation of a collection of Parameters
14
-	*
15
-	* A ParameterCollection maintains a list of the Parameters used to interpret command line arguments
16
-	* In addition to maintaining the Parameter list, this class is also responsible for "merging" Arguments
17
-	* with Parameters. This process involves using the Arguments (as parsed from the command line) to set
18
-	* values of Parameters in the collection.
19
-	*
20
-	* @internal
21
-	*
22
-	* @author Benjamin Hough
23
-	*
24
-	* @since 1.0.0
25
-	*/
13
+ * Representation of a collection of Parameters
14
+ *
15
+ * A ParameterCollection maintains a list of the Parameters used to interpret command line arguments
16
+ * In addition to maintaining the Parameter list, this class is also responsible for "merging" Arguments
17
+ * with Parameters. This process involves using the Arguments (as parsed from the command line) to set
18
+ * values of Parameters in the collection.
19
+ *
20
+ * @internal
21
+ *
22
+ * @author Benjamin Hough
23
+ *
24
+ * @since 1.0.0
25
+ */
26 26
 class ParameterCollection
27 27
 {	
28 28
 	//
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
 	//
41 41
 	
42 42
 	/**
43
-		* Magic function returns a string representation of this ParameterCollection
44
-		*
45
-		* @since 1.0.0
46
-		*
47
-		* @return string
48
-		*/
43
+	 * Magic function returns a string representation of this ParameterCollection
44
+	 *
45
+	 * @since 1.0.0
46
+	 *
47
+	 * @return string
48
+	 */
49 49
 	public function __toString()
50 50
 	{
51 51
 		return $this->toString();
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
56 56
 	//
57 57
 	
58 58
 	/**
59
-		* ParameterCollection constructor
60
-		*
61
-		* Constructs a new ParameterCollection with an empty list of Parameters
62
-		* and a "map" that can be used to reference Parameters in the collection by 'name' or 'tag'
63
-		*
64
-		* @since 1.0.0
65
-		*/
59
+	 * ParameterCollection constructor
60
+	 *
61
+	 * Constructs a new ParameterCollection with an empty list of Parameters
62
+	 * and a "map" that can be used to reference Parameters in the collection by 'name' or 'tag'
63
+	 *
64
+	 * @since 1.0.0
65
+	 */
66 66
 	public function __construct()
67 67
 	{
68 68
 		// Create a Parameter array
@@ -73,14 +73,14 @@  discard block
 block discarded – undo
73 73
 	}
74 74
 	
75 75
 	/**
76
-		* Returns TRUE when the specified $key matches the 'name' or 'flag' of a Parameter in the collection
77
-		*
78
-		* @since 1.0.0
79
-		* 
80
-		* @param string $key
81
-		*
82
-		* @return bool Returns TRUE when the specified $key matches a Parameter in the collection; FALSE otherwise.
83
-		*/
76
+	 * Returns TRUE when the specified $key matches the 'name' or 'flag' of a Parameter in the collection
77
+	 *
78
+	 * @since 1.0.0
79
+	 * 
80
+	 * @param string $key
81
+	 *
82
+	 * @return bool Returns TRUE when the specified $key matches a Parameter in the collection; FALSE otherwise.
83
+	 */
84 84
 	public function exists(string $key): bool
85 85
 	{
86 86
 		if( array_key_exists($key, $this->map) )
@@ -92,12 +92,12 @@  discard block
 block discarded – undo
92 92
 	}
93 93
 
94 94
 	/**
95
-		* Returns a boolean indicating if this collection contains a CommandParameter
96
-		*
97
-		* @since 1.0.0
98
-		*
99
-		* @return bool Returns TRUE when the collection contains a CommandParameter
100
-		*/
95
+	 * Returns a boolean indicating if this collection contains a CommandParameter
96
+	 *
97
+	 * @since 1.0.0
98
+	 *
99
+	 * @return bool Returns TRUE when the collection contains a CommandParameter
100
+	 */
101 101
 	public function hasCommand(): bool
102 102
 	{
103 103
 		foreach($this->parameters as $p)
@@ -111,12 +111,12 @@  discard block
 block discarded – undo
111 111
 	}
112 112
 	
113 113
 	/**
114
-		* Returns a boolean indicating if this collection contains a VariableParameter
115
-		*
116
-		* @since 1.0.0
117
-		*
118
-		* @return bool Returns TRUE when the collection contains a VariableParameter
119
-		*/
114
+	 * Returns a boolean indicating if this collection contains a VariableParameter
115
+	 *
116
+	 * @since 1.0.0
117
+	 *
118
+	 * @return bool Returns TRUE when the collection contains a VariableParameter
119
+	 */
120 120
 	public function hasVariable(): bool
121 121
 	{
122 122
 		foreach($this->parameters as $p)
@@ -130,15 +130,15 @@  discard block
 block discarded – undo
130 130
 	}
131 131
 	
132 132
 	/**
133
-		* Retrieves a Parameter in this collection by 'name' or 'flag'
134
-		*
135
-		* @since 1.0.0
136
-		*
137
-		* @param string $key The 'name' or 'flag' of a Parameter
138
-		* 
139
-		* @return Parameter
140
-		* @throws ArghException When there is no Parameter in the collection matching the specified $key
141
-		*/
133
+	 * Retrieves a Parameter in this collection by 'name' or 'flag'
134
+	 *
135
+	 * @since 1.0.0
136
+	 *
137
+	 * @param string $key The 'name' or 'flag' of a Parameter
138
+	 * 
139
+	 * @return Parameter
140
+	 * @throws ArghException When there is no Parameter in the collection matching the specified $key
141
+	 */
142 142
 	public function get(string $key): Parameter
143 143
 	{
144 144
 		if($this->exists($key))
@@ -154,15 +154,15 @@  discard block
 block discarded – undo
154 154
 	}
155 155
 	
156 156
 	/**
157
-		* Returns an array of command strings
158
-		*
159
-		* If this collection contains any CommandParameters,
160
-		* this method will return an array of the values defined by these commands.
161
-		*
162
-		* @since 1.0.0
163
-		*
164
-		* @return array
165
-		*/
157
+	 * Returns an array of command strings
158
+	 *
159
+	 * If this collection contains any CommandParameters,
160
+	 * this method will return an array of the values defined by these commands.
161
+	 *
162
+	 * @since 1.0.0
163
+	 *
164
+	 * @return array
165
+	 */
166 166
 	public function getCommands(): array
167 167
 	{
168 168
 		$commands = array();
@@ -179,14 +179,14 @@  discard block
 block discarded – undo
179 179
 	}
180 180
 
181 181
 	/**
182
-		* Adds a Parameter to the array of Parameters maintained by this collection.
183
-		*
184
-		* @since 1.0.0
185
-		*
186
-		* @param Parameter $param
187
-		* 
188
-		* @throws ArghException If a Parameter with the same 'name' already exists
189
-		*/
182
+	 * Adds a Parameter to the array of Parameters maintained by this collection.
183
+	 *
184
+	 * @since 1.0.0
185
+	 *
186
+	 * @param Parameter $param
187
+	 * 
188
+	 * @throws ArghException If a Parameter with the same 'name' already exists
189
+	 */
190 190
 	public function addParameter(Parameter $param)
191 191
 	{
192 192
 		if( !$this->exists($param->getName()) )
@@ -207,15 +207,15 @@  discard block
 block discarded – undo
207 207
 	}
208 208
 	
209 209
 	/**
210
-		* Given an array of Arguments, this method sets the 'value' of Parameters in the collection
211
-		* with the 'value' of its corresponding Argument.
212
-		*
213
-		* @since 1.0.0
214
-		*
215
-		* @param array $arguments An array of Arguments
216
-		*
217
-		* @throws ArgumentException
218
-		*/
210
+	 * Given an array of Arguments, this method sets the 'value' of Parameters in the collection
211
+	 * with the 'value' of its corresponding Argument.
212
+	 *
213
+	 * @since 1.0.0
214
+	 *
215
+	 * @param array $arguments An array of Arguments
216
+	 *
217
+	 * @throws ArgumentException
218
+	 */
219 219
 	public function mergeArguments(array $arguments): void
220 220
 	{
221 221
 		
@@ -265,24 +265,24 @@  discard block
 block discarded – undo
265 265
 	}
266 266
 	
267 267
 	/**
268
-		* Returns the array of Parameters in this collection.
269
-		*
270
-		* @since 1.0.0
271
-		*
272
-		* @return array Array of Parameters in this collection.
273
-		*/
268
+	 * Returns the array of Parameters in this collection.
269
+	 *
270
+	 * @since 1.0.0
271
+	 *
272
+	 * @return array Array of Parameters in this collection.
273
+	 */
274 274
 	public function all()
275 275
 	{
276 276
 		return $this->parameters;
277 277
 	}
278 278
 	
279 279
 	/**
280
-		* Returns a string representation of this ParameterCollection.
281
-		*
282
-		* @since 1.0.0
283
-		*
284
-		* @return string Returns
285
-		*/
280
+	 * Returns a string representation of this ParameterCollection.
281
+	 *
282
+	 * @since 1.0.0
283
+	 *
284
+	 * @return string Returns
285
+	 */
286 286
 	public function toString()
287 287
 	{
288 288
 		return print_r($this->parameters, TRUE);
Please login to merge, or discard this patch.
src/netfocusinc/argh/Parameter.php 1 patch
Indentation   +119 added lines, -119 removed lines patch added patch discarded remove patch
@@ -1,23 +1,23 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 /**
4
-	* Parameter.php
5
-	*/
4
+ * Parameter.php
5
+ */
6 6
 
7 7
 namespace netfocusinc\argh;
8 8
 
9 9
 /**
10
-	* Parameters define the arguments your CLI application can recieve.
11
-	*
12
-	* Parameters are pre-configured arguments that your CLI application can retrieve
13
-	* from command line arguments.
14
-	*
15
-	* @api
16
-	*
17
-	* @author  Benjamin Hough
18
-	*
19
-	* @since 1.0.0
20
-	*/
10
+ * Parameters define the arguments your CLI application can recieve.
11
+ *
12
+ * Parameters are pre-configured arguments that your CLI application can retrieve
13
+ * from command line arguments.
14
+ *
15
+ * @api
16
+ *
17
+ * @author  Benjamin Hough
18
+ *
19
+ * @since 1.0.0
20
+ */
21 21
 abstract class Parameter
22 22
 {
23 23
 	
@@ -59,12 +59,12 @@  discard block
 block discarded – undo
59 59
 	private $options;
60 60
 	
61 61
 	/** 
62
-		* @var mixed The value of this parameter.
63
-		*
64
-		* Null indicates no Argument was supplied on the command line.
65
-		* 
66
-		* Each Parameter may have its own type of value (e.g. int, string, array)
67
-		*/
62
+	 * @var mixed The value of this parameter.
63
+	 *
64
+	 * Null indicates no Argument was supplied on the command line.
65
+	 * 
66
+	 * Each Parameter may have its own type of value (e.g. int, string, array)
67
+	 */
68 68
 	protected $value;
69 69
 		
70 70
 	//
@@ -72,20 +72,20 @@  discard block
 block discarded – undo
72 72
 	//
73 73
 	
74 74
 	/**
75
-		* Creates a new Parameter (sub-type) using the provided attributes
76
-		*
77
-		* This function is called statically on the subtypes of Parameter (e.g. BooleanParameter)
78
-		* It uses the supplied attributes to construct a new Parameter.
79
-		*
80
-		* @api
81
-		*
82
-		* @since 1.0.0
83
-		*
84
-		* @param array $attributes
85
-		*
86
-		* @return Parameter
87
-		* @throws ArghException
88
-		*/
75
+	 * Creates a new Parameter (sub-type) using the provided attributes
76
+	 *
77
+	 * This function is called statically on the subtypes of Parameter (e.g. BooleanParameter)
78
+	 * It uses the supplied attributes to construct a new Parameter.
79
+	 *
80
+	 * @api
81
+	 *
82
+	 * @since 1.0.0
83
+	 *
84
+	 * @param array $attributes
85
+	 *
86
+	 * @return Parameter
87
+	 * @throws ArghException
88
+	 */
89 89
 	public static function createWithAttributes(array $attributes): Parameter
90 90
 	{
91 91
 		// Init default attributes for a new Parameter
@@ -116,24 +116,24 @@  discard block
 block discarded – undo
116 116
 	//
117 117
 	
118 118
 	/**
119
-		* Parameter contructor.
120
-		*
121
-		* This function defines a constructor that is leveraged by Parameter sub-types.
122
-		* Normally, Parameter (sub-types, e.g. BooleanParameter) are creating using the static Parameter:createWithAttributes() function.
123
-		* Parameter is an abstract class, and as such cannot be instantiated directly.
124
-		*
125
-		* @since 1.0.0
126
-		*
127
-		* @param string $name
128
-		* @param string $flag
129
-		* @param bool $required
130
-		* @param mixed $default
131
-		* @param string $description
132
-		* @param array $options
133
-		*
134
-		* @return Parameter
135
-		* @throws ArghException
136
-		*/
119
+	 * Parameter contructor.
120
+	 *
121
+	 * This function defines a constructor that is leveraged by Parameter sub-types.
122
+	 * Normally, Parameter (sub-types, e.g. BooleanParameter) are creating using the static Parameter:createWithAttributes() function.
123
+	 * Parameter is an abstract class, and as such cannot be instantiated directly.
124
+	 *
125
+	 * @since 1.0.0
126
+	 *
127
+	 * @param string $name
128
+	 * @param string $flag
129
+	 * @param bool $required
130
+	 * @param mixed $default
131
+	 * @param string $description
132
+	 * @param array $options
133
+	 *
134
+	 * @return Parameter
135
+	 * @throws ArghException
136
+	 */
137 137
 	public function __construct(string $name, string $flag=null, bool $required=FALSE, $default=null, string $description=null, array $options=array())
138 138
 	{ 
139 139
 		// Required a non-empty 'name'
@@ -159,66 +159,66 @@  discard block
 block discarded – undo
159 159
 	//
160 160
 	
161 161
 	/**
162
-		* Returns the text 'name' of this Parameter
163
-		*
164
-		* @since 1.0.0
165
-		*
166
-		* @return string
167
-		*/
162
+	 * Returns the text 'name' of this Parameter
163
+	 *
164
+	 * @since 1.0.0
165
+	 *
166
+	 * @return string
167
+	 */
168 168
 	public function getName(): string { return $this->name; }
169 169
 	
170 170
 	/**
171
-		* Returns the character 'flag' of this Parameter
172
-		*
173
-		* @since 1.0.0
174
-		*
175
-		* @return string
176
-		*/
171
+	 * Returns the character 'flag' of this Parameter
172
+	 *
173
+	 * @since 1.0.0
174
+	 *
175
+	 * @return string
176
+	 */
177 177
 	public function getFlag() { return $this->flag; }
178 178
 	
179 179
 	/**
180
-		* Returns the a boolean value indicating if this Parameter is required
181
-		*
182
-		* @since 1.0.0
183
-		*
184
-		* @return boolean
185
-		*/
180
+	 * Returns the a boolean value indicating if this Parameter is required
181
+	 *
182
+	 * @since 1.0.0
183
+	 *
184
+	 * @return boolean
185
+	 */
186 186
 	public function isRequired(): bool { return $this->required; }
187 187
 	
188 188
 	/**
189
-		* Returns the 'default' value of this Parmater
190
-		*
191
-		* @since 1.0.0
192
-		*
193
-		* @return mixed
194
-		*/
189
+	 * Returns the 'default' value of this Parmater
190
+	 *
191
+	 * @since 1.0.0
192
+	 *
193
+	 * @return mixed
194
+	 */
195 195
 	public function getDefault() { return $this->default; }
196 196
 	
197 197
 	/**
198
-		* Returns the text 'description' of this Parameter
199
-		*
200
-		* @since 1.0.0
201
-		*
202
-		* @return string
203
-		*/
198
+	 * Returns the text 'description' of this Parameter
199
+	 *
200
+	 * @since 1.0.0
201
+	 *
202
+	 * @return string
203
+	 */
204 204
 	public function getDescription() { return $this->description; }
205 205
 
206 206
 	/**
207
-		* Returns an array of 'options' that are legal for this Parameters 'value'
208
-		*
209
-		* @since 1.0.0
210
-		*
211
-		* @return array
212
-		*/
207
+	 * Returns an array of 'options' that are legal for this Parameters 'value'
208
+	 *
209
+	 * @since 1.0.0
210
+	 *
211
+	 * @return array
212
+	 */
213 213
 	public function	getOptions(): array { return $this->options; }
214 214
 	
215 215
 	/**
216
-		* Returns a boolean indicating if this Parameter has any defined 'options'
217
-		*
218
-		* @since 1.0.0
219
-		*
220
-		* @return bool
221
-		*/
216
+	 * Returns a boolean indicating if this Parameter has any defined 'options'
217
+	 *
218
+	 * @since 1.0.0
219
+	 *
220
+	 * @return bool
221
+	 */
222 222
 	public function hasOptions(): bool
223 223
 	{
224 224
 		if(count($this->options) > 0)
@@ -232,14 +232,14 @@  discard block
 block discarded – undo
232 232
 	}
233 233
 	
234 234
 	/**
235
-		* Returns a boolean indicating if the specified $value is a permissible 'option' of this Parameter
236
-		*
237
-		* @since 1.0.0
238
-		*
239
-		* @param mixed $value
240
-		* 
241
-		* @return bool
242
-		*/
235
+	 * Returns a boolean indicating if the specified $value is a permissible 'option' of this Parameter
236
+	 *
237
+	 * @since 1.0.0
238
+	 *
239
+	 * @param mixed $value
240
+	 * 
241
+	 * @return bool
242
+	 */
243 243
 	public function isOption($value): bool
244 244
 	{
245 245
 		if( in_array($value, $this->options) )
@@ -253,12 +253,12 @@  discard block
 block discarded – undo
253 253
 	}
254 254
 
255 255
 	/**
256
-		* Returns the 'value' of this Parameter
257
-		*
258
-		* @since 1.0.0
259
-		*
260
-		* @return mixed
261
-		*/	
256
+	 * Returns the 'value' of this Parameter
257
+	 *
258
+	 * @since 1.0.0
259
+	 *
260
+	 * @return mixed
261
+	 */	
262 262
 	public function getValue()
263 263
 	{
264 264
 		return $this->value;
@@ -269,21 +269,21 @@  discard block
 block discarded – undo
269 269
 	//
270 270
 	
271 271
 	/**
272
-		* Returns an int corresponding to this Parameters type
273
-		*
274
-		* @since 1.0.0
275
-		*
276
-		* @return int
277
-		*/
272
+	 * Returns an int corresponding to this Parameters type
273
+	 *
274
+	 * @since 1.0.0
275
+	 *
276
+	 * @return int
277
+	 */
278 278
 	abstract public function getParameterType(): int;
279 279
 	
280 280
 	/**
281
-		* Sets the 'value' of this Paramter
282
-		*
283
-		* @since 1.0.0
284
-		*
285
-		* @param mixed $value
286
-		*/
281
+	 * Sets the 'value' of this Paramter
282
+	 *
283
+	 * @since 1.0.0
284
+	 *
285
+	 * @param mixed $value
286
+	 */
287 287
 	abstract public function setValue($value);
288 288
 	
289 289
 }
Please login to merge, or discard this patch.
src/netfocusinc/argh/BooleanParameter.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -1,25 +1,25 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 	
3 3
 /**
4
-	* BooleanParameter.php
5
-	*/
4
+ * BooleanParameter.php
5
+ */
6 6
 	
7 7
 namespace netfocusinc\argh;
8 8
 
9 9
 use netfocusinc\argh\Parameter;
10 10
 
11 11
 /**
12
-	* Boolean parameter.
13
-	*
14
-	* Subtype of Parameter that represents a boolean value.
15
-	* Boolean parameters values are restricted to boolean literal values.
16
-	*
17
-	* @api
18
-	*
19
-	* @author Benjamin Hough
20
-	*
21
-	* @since 1.0.0
22
-	*/
12
+ * Boolean parameter.
13
+ *
14
+ * Subtype of Parameter that represents a boolean value.
15
+ * Boolean parameters values are restricted to boolean literal values.
16
+ *
17
+ * @api
18
+ *
19
+ * @author Benjamin Hough
20
+ *
21
+ * @since 1.0.0
22
+ */
23 23
 class BooleanParameter extends Parameter
24 24
 {
25 25
 	
@@ -33,14 +33,14 @@  discard block
 block discarded – undo
33 33
 	//
34 34
 
35 35
 	/**
36
-		* Returns a boolean default value for this Parameter.
37
-		*
38
-		* Overrides Parameter::getDefault() to ensure a boolean return value
39
-		*
40
-		* @since 1.0.0
41
-		*
42
-		* @return bool
43
-		*/	
36
+	 * Returns a boolean default value for this Parameter.
37
+	 *
38
+	 * Overrides Parameter::getDefault() to ensure a boolean return value
39
+	 *
40
+	 * @since 1.0.0
41
+	 *
42
+	 * @return bool
43
+	 */	
44 44
 	public function getDefault()
45 45
 	{
46 46
 		// Interpret any non-empty value as TRUE
@@ -56,26 +56,26 @@  discard block
 block discarded – undo
56 56
 	}
57 57
 	
58 58
 	/**
59
-		* Returns ARGH_TYPE_BOOLEAN
60
-		*
61
-		* @since 1.0.0
62
-		*
63
-		* @return int
64
-		*/
59
+	 * Returns ARGH_TYPE_BOOLEAN
60
+	 *
61
+	 * @since 1.0.0
62
+	 *
63
+	 * @return int
64
+	 */
65 65
 	public function getParameterType(): int
66 66
 	{
67 67
 		return Parameter::ARGH_TYPE_BOOLEAN;
68 68
 	}
69 69
 
70 70
 	/**
71
-		* Sets the boolean value of this Parameter.
72
-		*
73
-		* Translates any non boolean values to their boolean equivalents.
74
-		*
75
-		* @since 1.0.0
76
-		*
77
-		* @return int
78
-		*/
71
+	 * Sets the boolean value of this Parameter.
72
+	 *
73
+	 * Translates any non boolean values to their boolean equivalents.
74
+	 *
75
+	 * @since 1.0.0
76
+	 *
77
+	 * @return int
78
+	 */
79 79
 	public function setValue($value)
80 80
 	{
81 81
 				
Please login to merge, or discard this patch.
src/netfocusinc/argh/ListParameter.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 /**
4
-	* ListParameter.php
5
-	*/
4
+ * ListParameter.php
5
+ */
6 6
 	
7 7
 namespace netfocusinc\argh;
8 8
 
@@ -11,16 +11,16 @@  discard block
 block discarded – undo
11 11
 
12 12
 
13 13
 /**
14
-	* A List Parameter.
15
-	*
16
-	* Subtype of Parameter that represents a list of text values.
17
-	*
18
-	* @api
19
-	*
20
-	* @author Benjamin Hough
21
-	*
22
-	* @since 1.0.0
23
-	*/
14
+ * A List Parameter.
15
+ *
16
+ * Subtype of Parameter that represents a list of text values.
17
+ *
18
+ * @api
19
+ *
20
+ * @author Benjamin Hough
21
+ *
22
+ * @since 1.0.0
23
+ */
24 24
 class ListParameter extends Parameter
25 25
 {
26 26
 	
@@ -33,26 +33,26 @@  discard block
 block discarded – undo
33 33
 	//
34 34
 	
35 35
 	/**
36
-		* ReturnsParameter::ARGH_TYPE_LIST
37
-		*
38
-		* Identifies this Parameter subtype as a ListParameter by returning constant ARGH_TYPE_LIST
39
-		*
40
-		* @since 1.0.0
41
-		*
42
-		* @return int
43
-		*/
36
+	 * ReturnsParameter::ARGH_TYPE_LIST
37
+	 *
38
+	 * Identifies this Parameter subtype as a ListParameter by returning constant ARGH_TYPE_LIST
39
+	 *
40
+	 * @since 1.0.0
41
+	 *
42
+	 * @return int
43
+	 */
44 44
 	public function getParameterType(): int
45 45
 	{
46 46
 		return Parameter::ARGH_TYPE_LIST;
47 47
 	}
48 48
 
49 49
 	/**
50
-		* Sets the array value of this Parameter.
51
-		*
52
-		* Forces all values into an array
53
-		*
54
-		* @since 1.0.0
55
-		*/
50
+	 * Sets the array value of this Parameter.
51
+	 *
52
+	 * Forces all values into an array
53
+	 *
54
+	 * @since 1.0.0
55
+	 */
56 56
 	public function setValue($value)
57 57
 	{		
58 58
 		if(is_array($value))
@@ -66,14 +66,14 @@  discard block
 block discarded – undo
66 66
 	}
67 67
 
68 68
 	/**
69
-		* Adds an element to the value of this Parameter
70
-		*
71
-		* Forces all values into an array
72
-		*
73
-		* @since 1.0.0
74
-		*
75
-		* @return int
76
-		*/	
69
+	 * Adds an element to the value of this Parameter
70
+	 *
71
+	 * Forces all values into an array
72
+	 *
73
+	 * @since 1.0.0
74
+	 *
75
+	 * @return int
76
+	 */	
77 77
 	public function addValue($value)
78 78
 	{
79 79
 		// Check if this Parameter has a previously set value
Please login to merge, or discard this patch.