@@ -19,34 +19,34 @@ discard block |
||
19 | 19 | */ |
20 | 20 | class RequestHelper_Boundaries_Boundary |
21 | 21 | { |
22 | - /** |
|
23 | - * @var string |
|
24 | - */ |
|
22 | + /** |
|
23 | + * @var string |
|
24 | + */ |
|
25 | 25 | protected $content; |
26 | 26 | |
27 | - /** |
|
28 | - * @var array |
|
29 | - */ |
|
27 | + /** |
|
28 | + * @var array |
|
29 | + */ |
|
30 | 30 | protected $dispositionParams = array(); |
31 | 31 | |
32 | - /** |
|
33 | - * @var string |
|
34 | - */ |
|
32 | + /** |
|
33 | + * @var string |
|
34 | + */ |
|
35 | 35 | protected $contentType = ''; |
36 | 36 | |
37 | - /** |
|
38 | - * @var string |
|
39 | - */ |
|
37 | + /** |
|
38 | + * @var string |
|
39 | + */ |
|
40 | 40 | protected $contentEncoding = ''; |
41 | 41 | |
42 | - /** |
|
43 | - * @var RequestHelper_Boundaries |
|
44 | - */ |
|
42 | + /** |
|
43 | + * @var RequestHelper_Boundaries |
|
44 | + */ |
|
45 | 45 | protected $boundaries; |
46 | 46 | |
47 | - /** |
|
48 | - * @var string |
|
49 | - */ |
|
47 | + /** |
|
48 | + * @var string |
|
49 | + */ |
|
50 | 50 | protected $transferEncoding = ''; |
51 | 51 | |
52 | 52 | public function __construct(RequestHelper_Boundaries $boundaries, string $content) |
@@ -60,46 +60,46 @@ discard block |
||
60 | 60 | return strlen($this->content); |
61 | 61 | } |
62 | 62 | |
63 | - /** |
|
64 | - * Sets the name of the request parameter. |
|
65 | - * |
|
66 | - * @param string $name |
|
67 | - * @return RequestHelper_Boundaries_Boundary |
|
68 | - */ |
|
63 | + /** |
|
64 | + * Sets the name of the request parameter. |
|
65 | + * |
|
66 | + * @param string $name |
|
67 | + * @return RequestHelper_Boundaries_Boundary |
|
68 | + */ |
|
69 | 69 | public function setName(string $name) : RequestHelper_Boundaries_Boundary |
70 | 70 | { |
71 | 71 | return $this->setDispositionParam('name', $name); |
72 | 72 | } |
73 | 73 | |
74 | - /** |
|
75 | - * Sets the filename to use for the content, if applicable. |
|
76 | - * |
|
77 | - * @param string $fileName |
|
78 | - * @return RequestHelper_Boundaries_Boundary |
|
79 | - */ |
|
74 | + /** |
|
75 | + * Sets the filename to use for the content, if applicable. |
|
76 | + * |
|
77 | + * @param string $fileName |
|
78 | + * @return RequestHelper_Boundaries_Boundary |
|
79 | + */ |
|
80 | 80 | public function setFileName(string $fileName) : RequestHelper_Boundaries_Boundary |
81 | 81 | { |
82 | 82 | return $this->setDispositionParam('filename', $fileName); |
83 | 83 | } |
84 | 84 | |
85 | - /** |
|
86 | - * Sets the content type to use for the content. |
|
87 | - * |
|
88 | - * @param string $contentType |
|
89 | - * @return RequestHelper_Boundaries_Boundary |
|
90 | - */ |
|
85 | + /** |
|
86 | + * Sets the content type to use for the content. |
|
87 | + * |
|
88 | + * @param string $contentType |
|
89 | + * @return RequestHelper_Boundaries_Boundary |
|
90 | + */ |
|
91 | 91 | public function setContentType(string $contentType) : RequestHelper_Boundaries_Boundary |
92 | 92 | { |
93 | 93 | $this->contentType = $contentType; |
94 | 94 | return $this; |
95 | 95 | } |
96 | 96 | |
97 | - /** |
|
98 | - * Sets the encoding to specify for the content. |
|
99 | - * |
|
100 | - * @param string $encoding An encoding string, e.g. "UTF-8", "ASCII" |
|
101 | - * @return RequestHelper_Boundaries_Boundary |
|
102 | - */ |
|
97 | + /** |
|
98 | + * Sets the encoding to specify for the content. |
|
99 | + * |
|
100 | + * @param string $encoding An encoding string, e.g. "UTF-8", "ASCII" |
|
101 | + * @return RequestHelper_Boundaries_Boundary |
|
102 | + */ |
|
103 | 103 | public function setContentEncoding(string $encoding) : RequestHelper_Boundaries_Boundary |
104 | 104 | { |
105 | 105 | $this->contentEncoding = $encoding; |
@@ -119,11 +119,11 @@ discard block |
||
119 | 119 | return $this; |
120 | 120 | } |
121 | 121 | |
122 | - /** |
|
123 | - * Renders the mime boundary text. |
|
124 | - * |
|
125 | - * @return string |
|
126 | - */ |
|
122 | + /** |
|
123 | + * Renders the mime boundary text. |
|
124 | + * |
|
125 | + * @return string |
|
126 | + */ |
|
127 | 127 | public function render() |
128 | 128 | { |
129 | 129 | $eol = $this->boundaries->getEOL(); |
@@ -132,12 +132,12 @@ discard block |
||
132 | 132 | $lines[] = '--'.$this->boundaries->getMimeBoundary(); |
133 | 133 | $lines[] = $this->renderContentDisposition(); |
134 | 134 | |
135 | - if(!empty($this->contentType)) |
|
135 | + if (!empty($this->contentType)) |
|
136 | 136 | { |
137 | 137 | $lines[] = $this->renderContentType(); |
138 | 138 | } |
139 | 139 | |
140 | - if(!empty($this->transferEncoding)) |
|
140 | + if (!empty($this->transferEncoding)) |
|
141 | 141 | { |
142 | 142 | $lines[] = $this->renderTransferEncoding(); |
143 | 143 | } |
@@ -152,9 +152,9 @@ discard block |
||
152 | 152 | { |
153 | 153 | $result = 'Content-Disposition: form-data'; |
154 | 154 | |
155 | - foreach($this->dispositionParams as $name => $value) |
|
155 | + foreach ($this->dispositionParams as $name => $value) |
|
156 | 156 | { |
157 | - $result .= '; '.$name.'="' . $value . '"'; |
|
157 | + $result .= '; '.$name.'="'.$value.'"'; |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | return $result; |
@@ -162,11 +162,11 @@ discard block |
||
162 | 162 | |
163 | 163 | protected function renderContentType() : string |
164 | 164 | { |
165 | - $result = 'Content-Type: ' . $this->contentType; |
|
165 | + $result = 'Content-Type: '.$this->contentType; |
|
166 | 166 | |
167 | - if(!empty($this->contentEncoding)) |
|
167 | + if (!empty($this->contentEncoding)) |
|
168 | 168 | { |
169 | - $result .= '; charset="' . $this->contentEncoding.'"'; |
|
169 | + $result .= '; charset="'.$this->contentEncoding.'"'; |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | return $result; |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | |
175 | 175 | protected function renderTransferEncoding() : string |
176 | 176 | { |
177 | - $result = 'Content-Transfer-Encoding: ' . $this->transferEncoding; |
|
177 | + $result = 'Content-Transfer-Encoding: '.$this->transferEncoding; |
|
178 | 178 | |
179 | 179 | return $result; |
180 | 180 | } |
@@ -27,73 +27,73 @@ discard block |
||
27 | 27 | */ |
28 | 28 | class OperationResult |
29 | 29 | { |
30 | - /** |
|
31 | - * @var string |
|
32 | - */ |
|
30 | + /** |
|
31 | + * @var string |
|
32 | + */ |
|
33 | 33 | protected $message = ''; |
34 | 34 | |
35 | - /** |
|
36 | - * @var bool |
|
37 | - */ |
|
35 | + /** |
|
36 | + * @var bool |
|
37 | + */ |
|
38 | 38 | protected $valid = true; |
39 | 39 | |
40 | - /** |
|
41 | - * @var object |
|
42 | - */ |
|
40 | + /** |
|
41 | + * @var object |
|
42 | + */ |
|
43 | 43 | protected $subject; |
44 | 44 | |
45 | - /** |
|
46 | - * @var integer |
|
47 | - */ |
|
45 | + /** |
|
46 | + * @var integer |
|
47 | + */ |
|
48 | 48 | protected $code = 0; |
49 | 49 | |
50 | - /** |
|
51 | - * The subject being validated. |
|
52 | - * |
|
53 | - * @param object $subject |
|
54 | - */ |
|
50 | + /** |
|
51 | + * The subject being validated. |
|
52 | + * |
|
53 | + * @param object $subject |
|
54 | + */ |
|
55 | 55 | public function __construct(object $subject) |
56 | 56 | { |
57 | 57 | $this->subject = $subject; |
58 | 58 | } |
59 | 59 | |
60 | - /** |
|
61 | - * Whether the validation was successful. |
|
62 | - * |
|
63 | - * @return bool |
|
64 | - */ |
|
60 | + /** |
|
61 | + * Whether the validation was successful. |
|
62 | + * |
|
63 | + * @return bool |
|
64 | + */ |
|
65 | 65 | public function isValid() : bool |
66 | 66 | { |
67 | 67 | return $this->valid; |
68 | 68 | } |
69 | 69 | |
70 | - /** |
|
71 | - * Retrieves the subject that was validated. |
|
72 | - * |
|
73 | - * @return object |
|
74 | - */ |
|
70 | + /** |
|
71 | + * Retrieves the subject that was validated. |
|
72 | + * |
|
73 | + * @return object |
|
74 | + */ |
|
75 | 75 | public function getSubject() : object |
76 | 76 | { |
77 | 77 | return $this->subject; |
78 | 78 | } |
79 | 79 | |
80 | - /** |
|
81 | - * Makes the result a succes, with the specified message. |
|
82 | - * |
|
83 | - * @param string $message Should not contain a date, just the system specific info. |
|
84 | - * @return OperationResult |
|
85 | - */ |
|
80 | + /** |
|
81 | + * Makes the result a succes, with the specified message. |
|
82 | + * |
|
83 | + * @param string $message Should not contain a date, just the system specific info. |
|
84 | + * @return OperationResult |
|
85 | + */ |
|
86 | 86 | public function makeSuccess(string $message, int $code=0) : OperationResult |
87 | 87 | { |
88 | 88 | return $this->setMessage($message, $code, true); |
89 | 89 | } |
90 | 90 | |
91 | - /** |
|
92 | - * Sets the result as an error. |
|
93 | - * |
|
94 | - * @param string $message Should be as detailed as possible. |
|
95 | - * @return OperationResult |
|
96 | - */ |
|
91 | + /** |
|
92 | + * Sets the result as an error. |
|
93 | + * |
|
94 | + * @param string $message Should be as detailed as possible. |
|
95 | + * @return OperationResult |
|
96 | + */ |
|
97 | 97 | public function makeError(string $message, int $code=0) : OperationResult |
98 | 98 | { |
99 | 99 | return $this->setMessage($message, $code, false); |
@@ -108,21 +108,21 @@ discard block |
||
108 | 108 | return $this; |
109 | 109 | } |
110 | 110 | |
111 | - /** |
|
112 | - * Retrieves the error message, if an error occurred. |
|
113 | - * |
|
114 | - * @return string The error message, or an empty string if no error occurred. |
|
115 | - */ |
|
111 | + /** |
|
112 | + * Retrieves the error message, if an error occurred. |
|
113 | + * |
|
114 | + * @return string The error message, or an empty string if no error occurred. |
|
115 | + */ |
|
116 | 116 | public function getErrorMessage() : string |
117 | 117 | { |
118 | 118 | return $this->getMessage(false); |
119 | 119 | } |
120 | 120 | |
121 | - /** |
|
122 | - * Retrieves the success message, if one has been provided. |
|
123 | - * |
|
124 | - * @return string |
|
125 | - */ |
|
121 | + /** |
|
122 | + * Retrieves the success message, if one has been provided. |
|
123 | + * |
|
124 | + * @return string |
|
125 | + */ |
|
126 | 126 | public function getSuccessMessage() : string |
127 | 127 | { |
128 | 128 | return $this->getMessage(true); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * @param string $message Should not contain a date, just the system specific info. |
84 | 84 | * @return OperationResult |
85 | 85 | */ |
86 | - public function makeSuccess(string $message, int $code=0) : OperationResult |
|
86 | + public function makeSuccess(string $message, int $code = 0) : OperationResult |
|
87 | 87 | { |
88 | 88 | return $this->setMessage($message, $code, true); |
89 | 89 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * @param string $message Should be as detailed as possible. |
95 | 95 | * @return OperationResult |
96 | 96 | */ |
97 | - public function makeError(string $message, int $code=0) : OperationResult |
|
97 | + public function makeError(string $message, int $code = 0) : OperationResult |
|
98 | 98 | { |
99 | 99 | return $this->setMessage($message, $code, false); |
100 | 100 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | |
141 | 141 | protected function getMessage(bool $valid) : string |
142 | 142 | { |
143 | - if($this->valid === $valid) |
|
143 | + if ($this->valid === $valid) |
|
144 | 144 | { |
145 | 145 | return $this->message; |
146 | 146 | } |
@@ -26,18 +26,18 @@ discard block |
||
26 | 26 | */ |
27 | 27 | trait Traits_Optionable |
28 | 28 | { |
29 | - /** |
|
30 | - * @var array |
|
31 | - */ |
|
29 | + /** |
|
30 | + * @var array |
|
31 | + */ |
|
32 | 32 | protected $options; |
33 | 33 | |
34 | - /** |
|
35 | - * Sets an option to the specified value. This can be any |
|
36 | - * kind of variable type, including objects, as needed. |
|
37 | - * |
|
38 | - * @param string $name |
|
39 | - * @param mixed $value |
|
40 | - */ |
|
34 | + /** |
|
35 | + * Sets an option to the specified value. This can be any |
|
36 | + * kind of variable type, including objects, as needed. |
|
37 | + * |
|
38 | + * @param string $name |
|
39 | + * @param mixed $value |
|
40 | + */ |
|
41 | 41 | public function setOption(string $name, $value) |
42 | 42 | { |
43 | 43 | if(!isset($this->options)) { |
@@ -48,12 +48,12 @@ discard block |
||
48 | 48 | return $this; |
49 | 49 | } |
50 | 50 | |
51 | - /** |
|
52 | - * Sets a collection of options at once, from an |
|
53 | - * associative array. |
|
54 | - * |
|
55 | - * @param array $options |
|
56 | - */ |
|
51 | + /** |
|
52 | + * Sets a collection of options at once, from an |
|
53 | + * associative array. |
|
54 | + * |
|
55 | + * @param array $options |
|
56 | + */ |
|
57 | 57 | public function setOptions(array $options) |
58 | 58 | { |
59 | 59 | foreach($options as $name => $value) { |
@@ -63,16 +63,16 @@ discard block |
||
63 | 63 | return $this; |
64 | 64 | } |
65 | 65 | |
66 | - /** |
|
67 | - * Retrieves an option's value. |
|
68 | - * |
|
69 | - * NOTE: Use the specialized type getters to ensure an option |
|
70 | - * contains the expected type (for ex. getArrayOption()). |
|
71 | - * |
|
72 | - * @param string $name |
|
73 | - * @param mixed $default The default value to return if the option does not exist. |
|
74 | - * @return mixed |
|
75 | - */ |
|
66 | + /** |
|
67 | + * Retrieves an option's value. |
|
68 | + * |
|
69 | + * NOTE: Use the specialized type getters to ensure an option |
|
70 | + * contains the expected type (for ex. getArrayOption()). |
|
71 | + * |
|
72 | + * @param string $name |
|
73 | + * @param mixed $default The default value to return if the option does not exist. |
|
74 | + * @return mixed |
|
75 | + */ |
|
76 | 76 | public function getOption(string $name, $default=null) |
77 | 77 | { |
78 | 78 | if(!isset($this->options)) { |
@@ -86,16 +86,16 @@ discard block |
||
86 | 86 | return $default; |
87 | 87 | } |
88 | 88 | |
89 | - /** |
|
90 | - * Enforces that the option value is a string. Numbers are converted |
|
91 | - * to string, strings are passed through, and all other types will |
|
92 | - * return the default value. The default value is also returned if |
|
93 | - * the string is empty. |
|
94 | - * |
|
95 | - * @param string $name |
|
96 | - * @param string $default Used if the option does not exist, is invalid, or empty. |
|
97 | - * @return string |
|
98 | - */ |
|
89 | + /** |
|
90 | + * Enforces that the option value is a string. Numbers are converted |
|
91 | + * to string, strings are passed through, and all other types will |
|
92 | + * return the default value. The default value is also returned if |
|
93 | + * the string is empty. |
|
94 | + * |
|
95 | + * @param string $name |
|
96 | + * @param string $default Used if the option does not exist, is invalid, or empty. |
|
97 | + * @return string |
|
98 | + */ |
|
99 | 99 | public function getStringOption(string $name, string $default='') : string |
100 | 100 | { |
101 | 101 | $value = $this->getOption($name, false); |
@@ -107,15 +107,15 @@ discard block |
||
107 | 107 | return $default; |
108 | 108 | } |
109 | 109 | |
110 | - /** |
|
111 | - * Treats the option value as a boolean value: will return |
|
112 | - * true if the value actually is a boolean true. |
|
113 | - * |
|
114 | - * NOTE: boolean string representations are not accepted. |
|
115 | - * |
|
116 | - * @param string $name |
|
117 | - * @return bool |
|
118 | - */ |
|
110 | + /** |
|
111 | + * Treats the option value as a boolean value: will return |
|
112 | + * true if the value actually is a boolean true. |
|
113 | + * |
|
114 | + * NOTE: boolean string representations are not accepted. |
|
115 | + * |
|
116 | + * @param string $name |
|
117 | + * @return bool |
|
118 | + */ |
|
119 | 119 | public function getBoolOption(string $name, bool $default=false) : bool |
120 | 120 | { |
121 | 121 | if($this->getOption($name) === true) { |
@@ -125,15 +125,15 @@ discard block |
||
125 | 125 | return $default; |
126 | 126 | } |
127 | 127 | |
128 | - /** |
|
129 | - * Treats the option value as an integer value: will return |
|
130 | - * valid integer values (also from integer strings), or the |
|
131 | - * default value otherwise. |
|
132 | - * |
|
133 | - * @param string $name |
|
134 | - * @param int $default |
|
135 | - * @return int |
|
136 | - */ |
|
128 | + /** |
|
129 | + * Treats the option value as an integer value: will return |
|
130 | + * valid integer values (also from integer strings), or the |
|
131 | + * default value otherwise. |
|
132 | + * |
|
133 | + * @param string $name |
|
134 | + * @param int $default |
|
135 | + * @return int |
|
136 | + */ |
|
137 | 137 | public function getIntOption(string $name, int $default=0) : int |
138 | 138 | { |
139 | 139 | $value = $this->getOption($name); |
@@ -144,14 +144,14 @@ discard block |
||
144 | 144 | return $default; |
145 | 145 | } |
146 | 146 | |
147 | - /** |
|
148 | - * Treats an option as an array, and returns its value |
|
149 | - * only if it contains an array - otherwise, an empty |
|
150 | - * array is returned. |
|
151 | - * |
|
152 | - * @param string $name |
|
153 | - * @return array |
|
154 | - */ |
|
147 | + /** |
|
148 | + * Treats an option as an array, and returns its value |
|
149 | + * only if it contains an array - otherwise, an empty |
|
150 | + * array is returned. |
|
151 | + * |
|
152 | + * @param string $name |
|
153 | + * @return array |
|
154 | + */ |
|
155 | 155 | public function getArrayOption(string $name) : array |
156 | 156 | { |
157 | 157 | $val = $this->getOption($name); |
@@ -162,13 +162,13 @@ discard block |
||
162 | 162 | return array(); |
163 | 163 | } |
164 | 164 | |
165 | - /** |
|
166 | - * Checks whether the specified option exists - even |
|
167 | - * if it has a NULL value. |
|
168 | - * |
|
169 | - * @param string $name |
|
170 | - * @return bool |
|
171 | - */ |
|
165 | + /** |
|
166 | + * Checks whether the specified option exists - even |
|
167 | + * if it has a NULL value. |
|
168 | + * |
|
169 | + * @param string $name |
|
170 | + * @return bool |
|
171 | + */ |
|
172 | 172 | public function hasOption(string $name) : bool |
173 | 173 | { |
174 | 174 | if(!isset($this->options)) { |
@@ -178,10 +178,10 @@ discard block |
||
178 | 178 | return array_key_exists($name, $this->options); |
179 | 179 | } |
180 | 180 | |
181 | - /** |
|
182 | - * Returns all options in one associative array. |
|
183 | - * @return array |
|
184 | - */ |
|
181 | + /** |
|
182 | + * Returns all options in one associative array. |
|
183 | + * @return array |
|
184 | + */ |
|
185 | 185 | public function getOptions() : array |
186 | 186 | { |
187 | 187 | if(!isset($this->options)) { |
@@ -191,24 +191,24 @@ discard block |
||
191 | 191 | return $this->options; |
192 | 192 | } |
193 | 193 | |
194 | - /** |
|
195 | - * Checks whether the option's value is the one specified. |
|
196 | - * |
|
197 | - * @param string $name |
|
198 | - * @param mixed $value |
|
199 | - * @return bool |
|
200 | - */ |
|
194 | + /** |
|
195 | + * Checks whether the option's value is the one specified. |
|
196 | + * |
|
197 | + * @param string $name |
|
198 | + * @param mixed $value |
|
199 | + * @return bool |
|
200 | + */ |
|
201 | 201 | public function isOption(string $name, $value) : bool |
202 | 202 | { |
203 | 203 | return $this->getOption($name) === $value; |
204 | 204 | } |
205 | 205 | |
206 | - /** |
|
207 | - * Retrieves the default available options as an |
|
208 | - * associative array with option name => value pairs. |
|
209 | - * |
|
210 | - * @return array |
|
211 | - */ |
|
206 | + /** |
|
207 | + * Retrieves the default available options as an |
|
208 | + * associative array with option name => value pairs. |
|
209 | + * |
|
210 | + * @return array |
|
211 | + */ |
|
212 | 212 | abstract public function getDefaultOptions() : array; |
213 | 213 | } |
214 | 214 | |
@@ -226,24 +226,24 @@ discard block |
||
226 | 226 | */ |
227 | 227 | interface Interface_Optionable |
228 | 228 | { |
229 | - /** |
|
230 | - * @param string $name |
|
231 | - * @param mixed $value |
|
232 | - * @return $this |
|
233 | - */ |
|
229 | + /** |
|
230 | + * @param string $name |
|
231 | + * @param mixed $value |
|
232 | + * @return $this |
|
233 | + */ |
|
234 | 234 | function setOption(string $name, $value); |
235 | 235 | |
236 | - /** |
|
237 | - * @param string $name |
|
238 | - * @param mixed $default |
|
239 | - * @return $this |
|
240 | - */ |
|
236 | + /** |
|
237 | + * @param string $name |
|
238 | + * @param mixed $default |
|
239 | + * @return $this |
|
240 | + */ |
|
241 | 241 | function getOption(string $name, $default=null); |
242 | 242 | |
243 | - /** |
|
244 | - * @param array $options |
|
245 | - * @return $this |
|
246 | - */ |
|
243 | + /** |
|
244 | + * @param array $options |
|
245 | + * @return $this |
|
246 | + */ |
|
247 | 247 | function setOptions(array $options); |
248 | 248 | function getOptions() : array; |
249 | 249 | function isOption(string $name, $value) : bool; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function setOption(string $name, $value) |
42 | 42 | { |
43 | - if(!isset($this->options)) { |
|
43 | + if (!isset($this->options)) { |
|
44 | 44 | $this->options = $this->getDefaultOptions(); |
45 | 45 | } |
46 | 46 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function setOptions(array $options) |
58 | 58 | { |
59 | - foreach($options as $name => $value) { |
|
59 | + foreach ($options as $name => $value) { |
|
60 | 60 | $this->setOption($name, $value); |
61 | 61 | } |
62 | 62 | |
@@ -73,13 +73,13 @@ discard block |
||
73 | 73 | * @param mixed $default The default value to return if the option does not exist. |
74 | 74 | * @return mixed |
75 | 75 | */ |
76 | - public function getOption(string $name, $default=null) |
|
76 | + public function getOption(string $name, $default = null) |
|
77 | 77 | { |
78 | - if(!isset($this->options)) { |
|
78 | + if (!isset($this->options)) { |
|
79 | 79 | $this->options = $this->getDefaultOptions(); |
80 | 80 | } |
81 | 81 | |
82 | - if(isset($this->options[$name])) { |
|
82 | + if (isset($this->options[$name])) { |
|
83 | 83 | return $this->options[$name]; |
84 | 84 | } |
85 | 85 | |
@@ -96,11 +96,11 @@ discard block |
||
96 | 96 | * @param string $default Used if the option does not exist, is invalid, or empty. |
97 | 97 | * @return string |
98 | 98 | */ |
99 | - public function getStringOption(string $name, string $default='') : string |
|
99 | + public function getStringOption(string $name, string $default = '') : string |
|
100 | 100 | { |
101 | 101 | $value = $this->getOption($name, false); |
102 | 102 | |
103 | - if((is_string($value) || is_numeric($value)) && !empty($value)) { |
|
103 | + if ((is_string($value) || is_numeric($value)) && !empty($value)) { |
|
104 | 104 | return (string)$value; |
105 | 105 | } |
106 | 106 | |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | * @param string $name |
117 | 117 | * @return bool |
118 | 118 | */ |
119 | - public function getBoolOption(string $name, bool $default=false) : bool |
|
119 | + public function getBoolOption(string $name, bool $default = false) : bool |
|
120 | 120 | { |
121 | - if($this->getOption($name) === true) { |
|
121 | + if ($this->getOption($name) === true) { |
|
122 | 122 | return true; |
123 | 123 | } |
124 | 124 | |
@@ -134,10 +134,10 @@ discard block |
||
134 | 134 | * @param int $default |
135 | 135 | * @return int |
136 | 136 | */ |
137 | - public function getIntOption(string $name, int $default=0) : int |
|
137 | + public function getIntOption(string $name, int $default = 0) : int |
|
138 | 138 | { |
139 | 139 | $value = $this->getOption($name); |
140 | - if(ConvertHelper::isInteger($value)) { |
|
140 | + if (ConvertHelper::isInteger($value)) { |
|
141 | 141 | return (int)$value; |
142 | 142 | } |
143 | 143 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | public function getArrayOption(string $name) : array |
156 | 156 | { |
157 | 157 | $val = $this->getOption($name); |
158 | - if(is_array($val)) { |
|
158 | + if (is_array($val)) { |
|
159 | 159 | return $val; |
160 | 160 | } |
161 | 161 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | */ |
172 | 172 | public function hasOption(string $name) : bool |
173 | 173 | { |
174 | - if(!isset($this->options)) { |
|
174 | + if (!isset($this->options)) { |
|
175 | 175 | $this->options = $this->getDefaultOptions(); |
176 | 176 | } |
177 | 177 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | */ |
185 | 185 | public function getOptions() : array |
186 | 186 | { |
187 | - if(!isset($this->options)) { |
|
187 | + if (!isset($this->options)) { |
|
188 | 188 | $this->options = $this->getDefaultOptions(); |
189 | 189 | } |
190 | 190 | |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | * @param mixed $default |
239 | 239 | * @return $this |
240 | 240 | */ |
241 | - function getOption(string $name, $default=null); |
|
241 | + function getOption(string $name, $default = null); |
|
242 | 242 | |
243 | 243 | /** |
244 | 244 | * @param array $options |