@@ -55,8 +55,7 @@ |
||
55 | 55 | if(is_array($serialized)) |
56 | 56 | { |
57 | 57 | $this->parseSerialized($serialized); |
58 | - } |
|
59 | - else |
|
58 | + } else |
|
60 | 59 | { |
61 | 60 | $this->parseValue($value); |
62 | 61 | } |
@@ -37,19 +37,19 @@ discard block |
||
37 | 37 | |
38 | 38 | const ERROR_INVALID_SERIALIZED_DATA = 56301; |
39 | 39 | |
40 | - /** |
|
41 | - * @var string |
|
42 | - */ |
|
40 | + /** |
|
41 | + * @var string |
|
42 | + */ |
|
43 | 43 | protected $string; |
44 | 44 | |
45 | - /** |
|
46 | - * @var mixed |
|
47 | - */ |
|
45 | + /** |
|
46 | + * @var mixed |
|
47 | + */ |
|
48 | 48 | protected $value; |
49 | 49 | |
50 | - /** |
|
51 | - * @var string |
|
52 | - */ |
|
50 | + /** |
|
51 | + * @var string |
|
52 | + */ |
|
53 | 53 | protected $type; |
54 | 54 | |
55 | 55 | /** |
@@ -106,15 +106,15 @@ discard block |
||
106 | 106 | return new VariableInfo(null, $serialized); |
107 | 107 | } |
108 | 108 | |
109 | - /** |
|
110 | - * Parses a previously serialized data set to restore the |
|
111 | - * variable information from it. |
|
112 | - * |
|
113 | - * @param array $serialized |
|
114 | - * @throws BaseException |
|
115 | - * |
|
116 | - * @see VariableInfo::ERROR_INVALID_SERIALIZED_DATA |
|
117 | - */ |
|
109 | + /** |
|
110 | + * Parses a previously serialized data set to restore the |
|
111 | + * variable information from it. |
|
112 | + * |
|
113 | + * @param array $serialized |
|
114 | + * @throws BaseException |
|
115 | + * |
|
116 | + * @see VariableInfo::ERROR_INVALID_SERIALIZED_DATA |
|
117 | + */ |
|
118 | 118 | protected function parseSerialized(array $serialized) : void |
119 | 119 | { |
120 | 120 | if(!isset($serialized['string']) || !isset($serialized['type']) || !isset($serialized['options'])) |
@@ -156,12 +156,12 @@ discard block |
||
156 | 156 | return $this->value; |
157 | 157 | } |
158 | 158 | |
159 | - /** |
|
160 | - * The variable type - this is the same string that |
|
161 | - * is returned by the PHP function `gettype`. |
|
162 | - * |
|
163 | - * @return string |
|
164 | - */ |
|
159 | + /** |
|
160 | + * The variable type - this is the same string that |
|
161 | + * is returned by the PHP function `gettype`. |
|
162 | + * |
|
163 | + * @return string |
|
164 | + */ |
|
165 | 165 | public function getType() : string |
166 | 166 | { |
167 | 167 | return $this->type; |
@@ -175,13 +175,13 @@ discard block |
||
175 | 175 | ); |
176 | 176 | } |
177 | 177 | |
178 | - /** |
|
179 | - * Whether to prepend the variable type before the value, |
|
180 | - * like the var_dump function. Example: <code>string "Some text"</code>. |
|
181 | - * |
|
182 | - * @param bool $enable |
|
183 | - * @return VariableInfo |
|
184 | - */ |
|
178 | + /** |
|
179 | + * Whether to prepend the variable type before the value, |
|
180 | + * like the var_dump function. Example: <code>string "Some text"</code>. |
|
181 | + * |
|
182 | + * @param bool $enable |
|
183 | + * @return VariableInfo |
|
184 | + */ |
|
185 | 185 | public function enableType(bool $enable=true) : VariableInfo |
186 | 186 | { |
187 | 187 | return $this->setOption('prepend-type', $enable); |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | * @param array|null $serialized |
68 | 68 | * @throws BaseException |
69 | 69 | */ |
70 | - public function __construct($value, ?array $serialized=null) |
|
70 | + public function __construct($value, ?array $serialized = null) |
|
71 | 71 | { |
72 | - if(is_array($serialized)) |
|
72 | + if (is_array($serialized)) |
|
73 | 73 | { |
74 | 74 | $this->parseSerialized($serialized); |
75 | 75 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | protected function parseSerialized(array $serialized) : void |
119 | 119 | { |
120 | - if(!isset($serialized['string']) || !isset($serialized['type']) || !isset($serialized['options'])) |
|
120 | + if (!isset($serialized['string']) || !isset($serialized['type']) || !isset($serialized['options'])) |
|
121 | 121 | { |
122 | 122 | throw new BaseException( |
123 | 123 | 'Invalid variable info serialized data.', |
@@ -139,12 +139,12 @@ discard block |
||
139 | 139 | |
140 | 140 | // Gettype will return a string like "Resource(closed)" when |
141 | 141 | // working with a resource that has already been closed. |
142 | - if(strstr($this->type, 'resource')) |
|
142 | + if (strstr($this->type, 'resource')) |
|
143 | 143 | { |
144 | 144 | $this->type = self::TYPE_RESOURCE; |
145 | 145 | } |
146 | 146 | |
147 | - if(in_array($this->type, $this->callableTypes) && is_callable($value)) { |
|
147 | + if (in_array($this->type, $this->callableTypes) && is_callable($value)) { |
|
148 | 148 | $this->type = self::TYPE_CALLABLE; |
149 | 149 | } |
150 | 150 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * @param bool $enable |
183 | 183 | * @return VariableInfo |
184 | 184 | */ |
185 | - public function enableType(bool $enable=true) : VariableInfo |
|
185 | + public function enableType(bool $enable = true) : VariableInfo |
|
186 | 186 | { |
187 | 187 | return $this->setOption('prepend-type', $enable); |
188 | 188 | } |
@@ -191,9 +191,9 @@ discard block |
||
191 | 191 | { |
192 | 192 | $converted = $this->string; |
193 | 193 | |
194 | - if($this->getOption('prepend-type') === true && !$this->isNull()) |
|
194 | + if ($this->getOption('prepend-type') === true && !$this->isNull()) |
|
195 | 195 | { |
196 | - if($this->isString()) |
|
196 | + if ($this->isString()) |
|
197 | 197 | { |
198 | 198 | $converted = '"'.$converted.'"'; |
199 | 199 | } |
@@ -59,8 +59,7 @@ discard block |
||
59 | 59 | try |
60 | 60 | { |
61 | 61 | throw new BaseException(''); |
62 | - } |
|
63 | - catch(BaseException $e) |
|
62 | + } catch(BaseException $e) |
|
64 | 63 | { |
65 | 64 | echo self::createInfo($e)->toString(); |
66 | 65 | } |
@@ -74,8 +73,7 @@ discard block |
||
74 | 73 | try |
75 | 74 | { |
76 | 75 | throw new BaseException(''); |
77 | - } |
|
78 | - catch(BaseException $e) |
|
76 | + } catch(BaseException $e) |
|
79 | 77 | { |
80 | 78 | echo '<pre style="background:#fff;font-family:monospace;font-size:14px;color:#444;padding:16px;border:solid 1px #999;border-radius:4px;">'; |
81 | 79 | echo self::createInfo($e)->toString(); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @param int $code |
32 | 32 | * @param \Exception $previous |
33 | 33 | */ |
34 | - public function __construct(string $message, $details=null, $code=null, $previous=null) |
|
34 | + public function __construct(string $message, $details = null, $code = null, $previous = null) |
|
35 | 35 | { |
36 | 36 | parent::__construct($message, $code, $previous); |
37 | 37 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function getDetails() : string |
46 | 46 | { |
47 | - if($this->details !== null) { |
|
47 | + if ($this->details !== null) { |
|
48 | 48 | return $this->details; |
49 | 49 | } |
50 | 50 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function display() |
59 | 59 | { |
60 | - if(!headers_sent()) { |
|
60 | + if (!headers_sent()) { |
|
61 | 61 | header('Content-type:text/plain; charset=utf-8'); |
62 | 62 | } |
63 | 63 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | { |
86 | 86 | throw new BaseException(''); |
87 | 87 | } |
88 | - catch(BaseException $e) |
|
88 | + catch (BaseException $e) |
|
89 | 89 | { |
90 | 90 | echo self::createInfo($e)->toString(); |
91 | 91 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | { |
101 | 101 | throw new BaseException(''); |
102 | 102 | } |
103 | - catch(BaseException $e) |
|
103 | + catch (BaseException $e) |
|
104 | 104 | { |
105 | 105 | echo '<pre style="background:#fff;font-family:monospace;font-size:14px;color:#444;padding:16px;border:solid 1px #999;border-radius:4px;">'; |
106 | 106 | echo self::createInfo($e)->toString(); |
@@ -20,17 +20,17 @@ discard block |
||
20 | 20 | */ |
21 | 21 | class BaseException extends \Exception |
22 | 22 | { |
23 | - /** |
|
24 | - * @var string |
|
25 | - */ |
|
23 | + /** |
|
24 | + * @var string |
|
25 | + */ |
|
26 | 26 | protected $details; |
27 | 27 | |
28 | - /** |
|
29 | - * @param string $message |
|
30 | - * @param string $details |
|
31 | - * @param int $code |
|
32 | - * @param \Exception $previous |
|
33 | - */ |
|
28 | + /** |
|
29 | + * @param string $message |
|
30 | + * @param string $details |
|
31 | + * @param int $code |
|
32 | + * @param \Exception $previous |
|
33 | + */ |
|
34 | 34 | public function __construct(string $message, $details=null, $code=null, $previous=null) |
35 | 35 | { |
36 | 36 | parent::__construct($message, $code, $previous); |
@@ -38,10 +38,10 @@ discard block |
||
38 | 38 | $this->details = $details; |
39 | 39 | } |
40 | 40 | |
41 | - /** |
|
42 | - * Retrieves the detailed error description, if any. |
|
43 | - * @return string |
|
44 | - */ |
|
41 | + /** |
|
42 | + * Retrieves the detailed error description, if any. |
|
43 | + * @return string |
|
44 | + */ |
|
45 | 45 | public function getDetails() : string |
46 | 46 | { |
47 | 47 | if($this->details !== null) { |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | return ''; |
52 | 52 | } |
53 | 53 | |
54 | - /** |
|
55 | - * Displays pertinent information on the exception. |
|
56 | - */ |
|
54 | + /** |
|
55 | + * Displays pertinent information on the exception. |
|
56 | + */ |
|
57 | 57 | public function display() |
58 | 58 | { |
59 | 59 | if(!headers_sent()) { |
@@ -63,20 +63,20 @@ discard block |
||
63 | 63 | echo $this->getInfo(); |
64 | 64 | } |
65 | 65 | |
66 | - /** |
|
67 | - * Retrieves information on the exception that can be |
|
68 | - * easily accessed. |
|
69 | - * |
|
70 | - * @return ConvertHelper_ThrowableInfo |
|
71 | - */ |
|
66 | + /** |
|
67 | + * Retrieves information on the exception that can be |
|
68 | + * easily accessed. |
|
69 | + * |
|
70 | + * @return ConvertHelper_ThrowableInfo |
|
71 | + */ |
|
72 | 72 | public function getInfo() : ConvertHelper_ThrowableInfo |
73 | 73 | { |
74 | 74 | return ConvertHelper::throwable2info($this); |
75 | 75 | } |
76 | 76 | |
77 | - /** |
|
78 | - * Dumps a current PHP function trace, as a textonly string. |
|
79 | - */ |
|
77 | + /** |
|
78 | + * Dumps a current PHP function trace, as a textonly string. |
|
79 | + */ |
|
80 | 80 | public static function dumpTraceAsString() |
81 | 81 | { |
82 | 82 | try |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
92 | - /** |
|
93 | - * Dumps a current PHP function trace, with HTML styling. |
|
94 | - */ |
|
92 | + /** |
|
93 | + * Dumps a current PHP function trace, with HTML styling. |
|
94 | + */ |
|
95 | 95 | public static function dumpTraceAsHTML() |
96 | 96 | { |
97 | 97 | try |
@@ -106,13 +106,13 @@ discard block |
||
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
109 | - /** |
|
110 | - * Creates an exception info instance from a throwable instance. |
|
111 | - * |
|
112 | - * @param \Throwable $e |
|
113 | - * @return ConvertHelper_ThrowableInfo |
|
114 | - * @see ConvertHelper::throwable2info() |
|
115 | - */ |
|
109 | + /** |
|
110 | + * Creates an exception info instance from a throwable instance. |
|
111 | + * |
|
112 | + * @param \Throwable $e |
|
113 | + * @return ConvertHelper_ThrowableInfo |
|
114 | + * @see ConvertHelper::throwable2info() |
|
115 | + */ |
|
116 | 116 | public static function createInfo(\Throwable $e) : ConvertHelper_ThrowableInfo |
117 | 117 | { |
118 | 118 | return ConvertHelper::throwable2info($e); |
@@ -38,38 +38,38 @@ |
||
38 | 38 | */ |
39 | 39 | protected $text; |
40 | 40 | |
41 | - /** |
|
42 | - * @var string |
|
43 | - */ |
|
41 | + /** |
|
42 | + * @var string |
|
43 | + */ |
|
44 | 44 | protected $trimmed; |
45 | 45 | |
46 | - /** |
|
47 | - * @var int |
|
48 | - */ |
|
46 | + /** |
|
47 | + * @var int |
|
48 | + */ |
|
49 | 49 | protected $lineNumber; |
50 | 50 | |
51 | - /** |
|
52 | - * @var string |
|
53 | - */ |
|
51 | + /** |
|
52 | + * @var string |
|
53 | + */ |
|
54 | 54 | protected $type; |
55 | 55 | |
56 | - /** |
|
57 | - * @var string |
|
58 | - */ |
|
56 | + /** |
|
57 | + * @var string |
|
58 | + */ |
|
59 | 59 | protected $varName = ''; |
60 | 60 | |
61 | - /** |
|
62 | - * @var string |
|
63 | - */ |
|
61 | + /** |
|
62 | + * @var string |
|
63 | + */ |
|
64 | 64 | protected $varValue = ''; |
65 | 65 | |
66 | 66 | protected $valueUnquoted = ''; |
67 | 67 | |
68 | 68 | protected $quoteStyle = ''; |
69 | 69 | |
70 | - /** |
|
71 | - * @var string |
|
72 | - */ |
|
70 | + /** |
|
71 | + * @var string |
|
72 | + */ |
|
73 | 73 | protected $sectionName = ''; |
74 | 74 | |
75 | 75 | public function __construct(string $text, int $lineNumber) |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $this->trimmed = trim($text); |
79 | 79 | $this->lineNumber = $lineNumber; |
80 | 80 | |
81 | - if(empty($this->trimmed)) |
|
81 | + if (empty($this->trimmed)) |
|
82 | 82 | { |
83 | 83 | $this->type = self::TYPE_EMPTY; |
84 | 84 | return; |
@@ -86,11 +86,11 @@ discard block |
||
86 | 86 | |
87 | 87 | $startChar = substr($this->trimmed, 0, 1); |
88 | 88 | |
89 | - if($startChar === ';') |
|
89 | + if ($startChar === ';') |
|
90 | 90 | { |
91 | 91 | $this->type = self::TYPE_COMMENT; |
92 | 92 | } |
93 | - else if($startChar === '[') |
|
93 | + else if ($startChar === '[') |
|
94 | 94 | { |
95 | 95 | $this->type = self::TYPE_SECTION_DECLARATION; |
96 | 96 | $this->sectionName = trim($this->trimmed, '[]'); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | else |
100 | 100 | { |
101 | 101 | $pos = strpos($this->trimmed, '='); |
102 | - if($pos === false) |
|
102 | + if ($pos === false) |
|
103 | 103 | { |
104 | 104 | $this->type = self::TYPE_INVALID; |
105 | 105 | return; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $this->type = self::TYPE_VALUE; |
109 | 109 | $this->varName = trim(substr($this->trimmed, 0, $pos)); |
110 | 110 | |
111 | - $this->parseValue(substr($this->trimmed, $pos+1)); |
|
111 | + $this->parseValue(substr($this->trimmed, $pos + 1)); |
|
112 | 112 | } |
113 | 113 | } |
114 | 114 | |
@@ -118,12 +118,12 @@ discard block |
||
118 | 118 | |
119 | 119 | $value = $this->varValue; |
120 | 120 | |
121 | - if(substr($value, 0, 1) == '"' && substr($value, -1, 1) == '"') |
|
121 | + if (substr($value, 0, 1) == '"' && substr($value, -1, 1) == '"') |
|
122 | 122 | { |
123 | 123 | $value = trim($value, '"'); |
124 | 124 | $this->quoteStyle = '"'; |
125 | 125 | } |
126 | - else if(substr($value, 0, 1) == "'" && substr($value, -1, 1) == "'") |
|
126 | + else if (substr($value, 0, 1) == "'" && substr($value, -1, 1) == "'") |
|
127 | 127 | { |
128 | 128 | $value = trim($value, "'"); |
129 | 129 | $this->quoteStyle = "'"; |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | public function getQuotedVarValue() : string |
146 | 146 | { |
147 | - if($this->quoteStyle === '') { |
|
147 | + if ($this->quoteStyle === '') { |
|
148 | 148 | return $this->getVarValue(); |
149 | 149 | } |
150 | 150 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | |
199 | 199 | public function setValue($value) : IniHelper_Line |
200 | 200 | { |
201 | - if(!is_scalar($value)) |
|
201 | + if (!is_scalar($value)) |
|
202 | 202 | { |
203 | 203 | throw new IniHelper_Exception( |
204 | 204 | 'Cannot use non-scalar values.', |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | |
219 | 219 | public function toString() : string |
220 | 220 | { |
221 | - switch($this->type) |
|
221 | + switch ($this->type) |
|
222 | 222 | { |
223 | 223 | case self::TYPE_EMPTY: |
224 | 224 | case self::TYPE_INVALID: |
@@ -89,14 +89,12 @@ discard block |
||
89 | 89 | if($startChar === ';') |
90 | 90 | { |
91 | 91 | $this->type = self::TYPE_COMMENT; |
92 | - } |
|
93 | - else if($startChar === '[') |
|
92 | + } else if($startChar === '[') |
|
94 | 93 | { |
95 | 94 | $this->type = self::TYPE_SECTION_DECLARATION; |
96 | 95 | $this->sectionName = trim($this->trimmed, '[]'); |
97 | 96 | $this->sectionName = trim($this->sectionName); // remove any whitespace |
98 | - } |
|
99 | - else |
|
97 | + } else |
|
100 | 98 | { |
101 | 99 | $pos = strpos($this->trimmed, '='); |
102 | 100 | if($pos === false) |
@@ -122,8 +120,7 @@ discard block |
||
122 | 120 | { |
123 | 121 | $value = trim($value, '"'); |
124 | 122 | $this->quoteStyle = '"'; |
125 | - } |
|
126 | - else if(substr($value, 0, 1) == "'" && substr($value, -1, 1) == "'") |
|
123 | + } else if(substr($value, 0, 1) == "'" && substr($value, -1, 1) == "'") |
|
127 | 124 | { |
128 | 125 | $value = trim($value, "'"); |
129 | 126 | $this->quoteStyle = "'"; |
@@ -21,19 +21,19 @@ discard block |
||
21 | 21 | */ |
22 | 22 | class IniHelper_Section |
23 | 23 | { |
24 | - /** |
|
25 | - * @var IniHelper |
|
26 | - */ |
|
24 | + /** |
|
25 | + * @var IniHelper |
|
26 | + */ |
|
27 | 27 | protected $ini; |
28 | 28 | |
29 | - /** |
|
30 | - * @var string |
|
31 | - */ |
|
29 | + /** |
|
30 | + * @var string |
|
31 | + */ |
|
32 | 32 | protected $name; |
33 | 33 | |
34 | - /** |
|
35 | - * @var IniHelper_Line[] |
|
36 | - */ |
|
34 | + /** |
|
35 | + * @var IniHelper_Line[] |
|
36 | + */ |
|
37 | 37 | protected $lines = array(); |
38 | 38 | |
39 | 39 | public function __construct(IniHelper $ini, string $name) |
@@ -42,33 +42,33 @@ discard block |
||
42 | 42 | $this->name = $name; |
43 | 43 | } |
44 | 44 | |
45 | - /** |
|
46 | - * The section's name. |
|
47 | - * @return string |
|
48 | - */ |
|
45 | + /** |
|
46 | + * The section's name. |
|
47 | + * @return string |
|
48 | + */ |
|
49 | 49 | public function getName() : string |
50 | 50 | { |
51 | 51 | return $this->name; |
52 | 52 | } |
53 | 53 | |
54 | - /** |
|
55 | - * Whether this is the default section: this |
|
56 | - * is used internally to store all variables that |
|
57 | - * are not in any specific section. |
|
58 | - * |
|
59 | - * @return bool |
|
60 | - */ |
|
54 | + /** |
|
55 | + * Whether this is the default section: this |
|
56 | + * is used internally to store all variables that |
|
57 | + * are not in any specific section. |
|
58 | + * |
|
59 | + * @return bool |
|
60 | + */ |
|
61 | 61 | public function isDefault() : bool |
62 | 62 | { |
63 | 63 | return $this->name === IniHelper::SECTION_DEFAULT; |
64 | 64 | } |
65 | 65 | |
66 | - /** |
|
67 | - * Adds a line instance to the section. |
|
68 | - * |
|
69 | - * @param IniHelper_Line $line |
|
70 | - * @return IniHelper_Section |
|
71 | - */ |
|
66 | + /** |
|
67 | + * Adds a line instance to the section. |
|
68 | + * |
|
69 | + * @param IniHelper_Line $line |
|
70 | + * @return IniHelper_Section |
|
71 | + */ |
|
72 | 72 | public function addLine(IniHelper_Line $line) : IniHelper_Section |
73 | 73 | { |
74 | 74 | $this->lines[] = $line; |
@@ -76,12 +76,12 @@ discard block |
||
76 | 76 | return $this; |
77 | 77 | } |
78 | 78 | |
79 | - /** |
|
80 | - * Converts the values contained in the section into |
|
81 | - * an associative array. |
|
82 | - * |
|
83 | - * @return array |
|
84 | - */ |
|
79 | + /** |
|
80 | + * Converts the values contained in the section into |
|
81 | + * an associative array. |
|
82 | + * |
|
83 | + * @return array |
|
84 | + */ |
|
85 | 85 | public function toArray() : array |
86 | 86 | { |
87 | 87 | $result = array(); |
@@ -114,11 +114,11 @@ discard block |
||
114 | 114 | return $result; |
115 | 115 | } |
116 | 116 | |
117 | - /** |
|
118 | - * Converts the section's lines into an INI string. |
|
119 | - * |
|
120 | - * @return string |
|
121 | - */ |
|
117 | + /** |
|
118 | + * Converts the section's lines into an INI string. |
|
119 | + * |
|
120 | + * @return string |
|
121 | + */ |
|
122 | 122 | public function toString() |
123 | 123 | { |
124 | 124 | $lines = array(); |
@@ -140,12 +140,12 @@ discard block |
||
140 | 140 | return implode($this->ini->getEOLChar(), $lines); |
141 | 141 | } |
142 | 142 | |
143 | - /** |
|
144 | - * Deletes a line from the section. |
|
145 | - * |
|
146 | - * @param IniHelper_Line $toDelete |
|
147 | - * @return IniHelper_Section |
|
148 | - */ |
|
143 | + /** |
|
144 | + * Deletes a line from the section. |
|
145 | + * |
|
146 | + * @param IniHelper_Line $toDelete |
|
147 | + * @return IniHelper_Section |
|
148 | + */ |
|
149 | 149 | public function deleteLine(IniHelper_Line $toDelete) : IniHelper_Section |
150 | 150 | { |
151 | 151 | $keep = array(); |
@@ -162,13 +162,13 @@ discard block |
||
162 | 162 | return $this; |
163 | 163 | } |
164 | 164 | |
165 | - /** |
|
166 | - * Sets the value of a variable, overwriting any existing value. |
|
167 | - * |
|
168 | - * @param string $name |
|
169 | - * @param mixed $value If an array is specified, it is treated as duplicate keys and will add a line for each value. |
|
170 | - * @return IniHelper_Section |
|
171 | - */ |
|
165 | + /** |
|
166 | + * Sets the value of a variable, overwriting any existing value. |
|
167 | + * |
|
168 | + * @param string $name |
|
169 | + * @param mixed $value If an array is specified, it is treated as duplicate keys and will add a line for each value. |
|
170 | + * @return IniHelper_Section |
|
171 | + */ |
|
172 | 172 | public function setValue(string $name, $value) : IniHelper_Section |
173 | 173 | { |
174 | 174 | $lines = $this->getLinesByVariable($name); |
@@ -229,15 +229,15 @@ discard block |
||
229 | 229 | return $this; |
230 | 230 | } |
231 | 231 | |
232 | - /** |
|
233 | - * Adds a variable value to the section. Unlike setValue(), this |
|
234 | - * will not overwrite any existing value. If the name is an existing |
|
235 | - * variable name, it will be converted to duplicate keys. |
|
236 | - * |
|
237 | - * @param string $name |
|
238 | - * @param mixed $value If this is an array, it will be treated as duplicate keys, and all values that are not present yet will be added. |
|
239 | - * @return IniHelper_Section |
|
240 | - */ |
|
232 | + /** |
|
233 | + * Adds a variable value to the section. Unlike setValue(), this |
|
234 | + * will not overwrite any existing value. If the name is an existing |
|
235 | + * variable name, it will be converted to duplicate keys. |
|
236 | + * |
|
237 | + * @param string $name |
|
238 | + * @param mixed $value If this is an array, it will be treated as duplicate keys, and all values that are not present yet will be added. |
|
239 | + * @return IniHelper_Section |
|
240 | + */ |
|
241 | 241 | public function addValue(string $name, $value) : IniHelper_Section |
242 | 242 | { |
243 | 243 | // array value? Treat it as duplicate keys. |
@@ -295,12 +295,12 @@ discard block |
||
295 | 295 | } |
296 | 296 | |
297 | 297 | |
298 | - /** |
|
299 | - * Retrieves all lines for the specified variable name. |
|
300 | - * |
|
301 | - * @param string $name |
|
302 | - * @return \AppUtils\IniHelper_Line[] |
|
303 | - */ |
|
298 | + /** |
|
299 | + * Retrieves all lines for the specified variable name. |
|
300 | + * |
|
301 | + * @param string $name |
|
302 | + * @return \AppUtils\IniHelper_Line[] |
|
303 | + */ |
|
304 | 304 | public function getLinesByVariable(string $name) |
305 | 305 | { |
306 | 306 | $result = array(); |
@@ -86,15 +86,15 @@ discard block |
||
86 | 86 | { |
87 | 87 | $result = array(); |
88 | 88 | |
89 | - foreach($this->lines as $line) |
|
89 | + foreach ($this->lines as $line) |
|
90 | 90 | { |
91 | - if(!$line->isValue()) { |
|
91 | + if (!$line->isValue()) { |
|
92 | 92 | continue; |
93 | 93 | } |
94 | 94 | |
95 | 95 | $name = $line->getVarName(); |
96 | 96 | |
97 | - if(!isset($result[$name])) |
|
97 | + if (!isset($result[$name])) |
|
98 | 98 | { |
99 | 99 | $result[$name] = $line->getVarValue(); |
100 | 100 | continue; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | // name exists in collection? Then this is a |
104 | 104 | // duplicate key and we need to convert it to |
105 | 105 | // an indexed array of values. |
106 | - if(!is_array($result[$name])) |
|
106 | + if (!is_array($result[$name])) |
|
107 | 107 | { |
108 | 108 | $result[$name] = array($result[$name]); |
109 | 109 | } |
@@ -122,15 +122,15 @@ discard block |
||
122 | 122 | public function toString() |
123 | 123 | { |
124 | 124 | $lines = array(); |
125 | - if(!$this->isDefault()) |
|
125 | + if (!$this->isDefault()) |
|
126 | 126 | { |
127 | 127 | $lines[] = '['.$this->getName().']'; |
128 | 128 | } |
129 | 129 | |
130 | - foreach($this->lines as $line) |
|
130 | + foreach ($this->lines as $line) |
|
131 | 131 | { |
132 | 132 | // we already did this |
133 | - if($line->isSection()) { |
|
133 | + if ($line->isSection()) { |
|
134 | 134 | continue; |
135 | 135 | } |
136 | 136 | |
@@ -150,9 +150,9 @@ discard block |
||
150 | 150 | { |
151 | 151 | $keep = array(); |
152 | 152 | |
153 | - foreach($this->lines as $line) |
|
153 | + foreach ($this->lines as $line) |
|
154 | 154 | { |
155 | - if($line !== $toDelete) { |
|
155 | + if ($line !== $toDelete) { |
|
156 | 156 | $keep[] = $line; |
157 | 157 | } |
158 | 158 | } |
@@ -177,23 +177,23 @@ discard block |
||
177 | 177 | // Removes any superfluous values that may |
178 | 178 | // already exist, if there are more than the |
179 | 179 | // new set of values. |
180 | - if(is_array($value)) |
|
180 | + if (is_array($value)) |
|
181 | 181 | { |
182 | 182 | $values = array_values($value); |
183 | 183 | $amountNew = count($values); |
184 | 184 | $amountExisting = count($lines); |
185 | 185 | |
186 | 186 | $max = $amountNew; |
187 | - if($amountExisting > $max) { |
|
187 | + if ($amountExisting > $max) { |
|
188 | 188 | $max = $amountExisting; |
189 | 189 | } |
190 | 190 | |
191 | - for($i=0; $i < $max; $i++) |
|
191 | + for ($i = 0; $i < $max; $i++) |
|
192 | 192 | { |
193 | 193 | // new value exists |
194 | - if(isset($values[$i])) |
|
194 | + if (isset($values[$i])) |
|
195 | 195 | { |
196 | - if(isset($lines[$i])) { |
|
196 | + if (isset($lines[$i])) { |
|
197 | 197 | $lines[$i]->setValue($values[$i]); |
198 | 198 | } else { |
199 | 199 | $this->addValueLine($name, $values[$i]); |
@@ -211,12 +211,12 @@ discard block |
||
211 | 211 | else |
212 | 212 | { |
213 | 213 | // remove all superfluous lines |
214 | - if(!empty($lines)) |
|
214 | + if (!empty($lines)) |
|
215 | 215 | { |
216 | 216 | $line = array_shift($lines); // keep only the first line |
217 | 217 | $line->setValue($value); |
218 | 218 | |
219 | - foreach($lines as $delete) { |
|
219 | + foreach ($lines as $delete) { |
|
220 | 220 | $this->deleteLine($delete); |
221 | 221 | } |
222 | 222 | } |
@@ -241,11 +241,11 @@ discard block |
||
241 | 241 | public function addValue(string $name, $value) : IniHelper_Section |
242 | 242 | { |
243 | 243 | // array value? Treat it as duplicate keys. |
244 | - if(is_array($value)) |
|
244 | + if (is_array($value)) |
|
245 | 245 | { |
246 | 246 | $values = array_values($value); |
247 | 247 | |
248 | - foreach($values as $setValue) |
|
248 | + foreach ($values as $setValue) |
|
249 | 249 | { |
250 | 250 | $this->addValue($name, $setValue); |
251 | 251 | } |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | |
256 | 256 | $lines = $this->getLinesByVariable($name); |
257 | 257 | |
258 | - if(empty($lines)) |
|
258 | + if (empty($lines)) |
|
259 | 259 | { |
260 | 260 | $this->addValueLine($name, $value); |
261 | 261 | } |
@@ -263,15 +263,15 @@ discard block |
||
263 | 263 | { |
264 | 264 | $found = false; |
265 | 265 | |
266 | - foreach($lines as $line) |
|
266 | + foreach ($lines as $line) |
|
267 | 267 | { |
268 | - if($line->getVarValue() === $value) { |
|
268 | + if ($line->getVarValue() === $value) { |
|
269 | 269 | $found = $line; |
270 | 270 | break; |
271 | 271 | } |
272 | 272 | } |
273 | 273 | |
274 | - if(!$found) |
|
274 | + if (!$found) |
|
275 | 275 | { |
276 | 276 | $this->addValueLine($name, $value); |
277 | 277 | } |
@@ -305,9 +305,9 @@ discard block |
||
305 | 305 | { |
306 | 306 | $result = array(); |
307 | 307 | |
308 | - foreach($this->lines as $line) |
|
308 | + foreach ($this->lines as $line) |
|
309 | 309 | { |
310 | - if($line->isValue() && $line->getVarName() === $name) { |
|
310 | + if ($line->isValue() && $line->getVarName() === $name) { |
|
311 | 311 | $result[] = $line; |
312 | 312 | } |
313 | 313 | } |
@@ -198,8 +198,7 @@ discard block |
||
198 | 198 | } else { |
199 | 199 | $this->addValueLine($name, $values[$i]); |
200 | 200 | } |
201 | - } |
|
202 | - else |
|
201 | + } else |
|
203 | 202 | { |
204 | 203 | $this->deleteLine($lines[$i]); |
205 | 204 | } |
@@ -219,8 +218,7 @@ discard block |
||
219 | 218 | foreach($lines as $delete) { |
220 | 219 | $this->deleteLine($delete); |
221 | 220 | } |
222 | - } |
|
223 | - else |
|
221 | + } else |
|
224 | 222 | { |
225 | 223 | $this->addValueLine($name, $value); |
226 | 224 | } |
@@ -258,8 +256,7 @@ discard block |
||
258 | 256 | if(empty($lines)) |
259 | 257 | { |
260 | 258 | $this->addValueLine($name, $value); |
261 | - } |
|
262 | - else |
|
259 | + } else |
|
263 | 260 | { |
264 | 261 | $found = false; |
265 | 262 |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | return $this->setOption('separatorChar', $char); |
18 | 18 | } |
19 | 19 | |
20 | - public function setTrailingNewline($useNewline=true) |
|
20 | + public function setTrailingNewline($useNewline = true) |
|
21 | 21 | { |
22 | 22 | return $this->setOption('trailingNewline', $useNewline); |
23 | 23 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $args = $args[0]; |
39 | 39 | } |
40 | 40 | |
41 | - $this->lines[] = '"' . implode('"'.$this->getOption('separatorChar').'"', $args) . '"'; |
|
41 | + $this->lines[] = '"'.implode('"'.$this->getOption('separatorChar').'"', $args).'"'; |
|
42 | 42 | |
43 | 43 | return $this; |
44 | 44 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | { |
55 | 55 | $csv = implode(PHP_EOL, $this->lines); |
56 | 56 | |
57 | - if($this->getOption('trailingNewline')) { |
|
57 | + if ($this->getOption('trailingNewline')) { |
|
58 | 58 | $csv .= PHP_EOL; |
59 | 59 | } |
60 | 60 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | public function setOption($name, $value) |
67 | 67 | { |
68 | - if(!isset($this->options)) { |
|
68 | + if (!isset($this->options)) { |
|
69 | 69 | $this->options = $this->getDefaultOptions(); |
70 | 70 | } |
71 | 71 | |
@@ -75,20 +75,20 @@ discard block |
||
75 | 75 | |
76 | 76 | public function setOptions($options) |
77 | 77 | { |
78 | - foreach($options as $name => $value) { |
|
78 | + foreach ($options as $name => $value) { |
|
79 | 79 | $this->setOption($name, $value); |
80 | 80 | } |
81 | 81 | |
82 | 82 | return $this; |
83 | 83 | } |
84 | 84 | |
85 | - public function getOption($name, $default=null) |
|
85 | + public function getOption($name, $default = null) |
|
86 | 86 | { |
87 | - if(!isset($this->options)) { |
|
87 | + if (!isset($this->options)) { |
|
88 | 88 | $this->options = $this->getDefaultOptions(); |
89 | 89 | } |
90 | 90 | |
91 | - if(isset($this->options[$name])) { |
|
91 | + if (isset($this->options[$name])) { |
|
92 | 92 | return $this->options[$name]; |
93 | 93 | } |
94 | 94 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | |
98 | 98 | public function hasOption($name) |
99 | 99 | { |
100 | - if(!isset($this->options)) { |
|
100 | + if (!isset($this->options)) { |
|
101 | 101 | $this->options = $this->getDefaultOptions(); |
102 | 102 | } |
103 | 103 | |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | public function getOptions() |
108 | 108 | { |
109 | - if(!isset($this->options)) { |
|
109 | + if (!isset($this->options)) { |
|
110 | 110 | $this->options = $this->getDefaultOptions(); |
111 | 111 | } |
112 | 112 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | public function isOption($name, $value) |
117 | 117 | { |
118 | - if($this->getOption($name) === $value) { |
|
118 | + if ($this->getOption($name) === $value) { |
|
119 | 119 | return true; |
120 | 120 | } |
121 | 121 |
@@ -36,17 +36,17 @@ discard block |
||
36 | 36 | |
37 | 37 | protected $classes = array(); |
38 | 38 | |
39 | - /** |
|
40 | - * The namespace detected in the file, if any. |
|
41 | - * @var string |
|
42 | - */ |
|
39 | + /** |
|
40 | + * The namespace detected in the file, if any. |
|
41 | + * @var string |
|
42 | + */ |
|
43 | 43 | protected $namespace = ''; |
44 | 44 | |
45 | - /** |
|
46 | - * @param string $path The path to the PHP file to parse. |
|
47 | - * @throws FileHelper_Exception |
|
48 | - * @see FileHelper::findPHPClasses() |
|
49 | - */ |
|
45 | + /** |
|
46 | + * @param string $path The path to the PHP file to parse. |
|
47 | + * @throws FileHelper_Exception |
|
48 | + * @see FileHelper::findPHPClasses() |
|
49 | + */ |
|
50 | 50 | public function __construct(string $path) |
51 | 51 | { |
52 | 52 | $this->path = realpath($path); |
@@ -66,66 +66,66 @@ discard block |
||
66 | 66 | $this->parseFile(); |
67 | 67 | } |
68 | 68 | |
69 | - /** |
|
70 | - * The name of the namespace of the classes in the file, if any. |
|
71 | - * @return string |
|
72 | - */ |
|
69 | + /** |
|
70 | + * The name of the namespace of the classes in the file, if any. |
|
71 | + * @return string |
|
72 | + */ |
|
73 | 73 | public function getNamespace() : string |
74 | 74 | { |
75 | 75 | return $this->namespace; |
76 | 76 | } |
77 | 77 | |
78 | - /** |
|
79 | - * Whether the file contains a namespace. |
|
80 | - * @return bool |
|
81 | - */ |
|
78 | + /** |
|
79 | + * Whether the file contains a namespace. |
|
80 | + * @return bool |
|
81 | + */ |
|
82 | 82 | public function hasNamespace() : bool |
83 | 83 | { |
84 | 84 | return !empty($this->namespace); |
85 | 85 | } |
86 | 86 | |
87 | - /** |
|
88 | - * The absolute path to the file. |
|
89 | - * @return string |
|
90 | - */ |
|
87 | + /** |
|
88 | + * The absolute path to the file. |
|
89 | + * @return string |
|
90 | + */ |
|
91 | 91 | public function getPath() : string |
92 | 92 | { |
93 | 93 | return $this->path; |
94 | 94 | } |
95 | 95 | |
96 | - /** |
|
97 | - * Whether any classes were found in the file. |
|
98 | - * @return bool |
|
99 | - */ |
|
96 | + /** |
|
97 | + * Whether any classes were found in the file. |
|
98 | + * @return bool |
|
99 | + */ |
|
100 | 100 | public function hasClasses() : bool |
101 | 101 | { |
102 | 102 | return !empty($this->classes); |
103 | 103 | } |
104 | 104 | |
105 | - /** |
|
106 | - * The names of the classes that were found in the file (with namespace if any). |
|
107 | - * @return string[] |
|
108 | - */ |
|
105 | + /** |
|
106 | + * The names of the classes that were found in the file (with namespace if any). |
|
107 | + * @return string[] |
|
108 | + */ |
|
109 | 109 | public function getClassNames() : array |
110 | 110 | { |
111 | 111 | return array_keys($this->classes); |
112 | 112 | } |
113 | 113 | |
114 | - /** |
|
115 | - * Retrieves all classes that were detected in the file, |
|
116 | - * which can be used to retrieve more information about |
|
117 | - * them. |
|
118 | - * |
|
119 | - * @return FileHelper_PHPClassInfo_Class[] |
|
120 | - */ |
|
114 | + /** |
|
115 | + * Retrieves all classes that were detected in the file, |
|
116 | + * which can be used to retrieve more information about |
|
117 | + * them. |
|
118 | + * |
|
119 | + * @return FileHelper_PHPClassInfo_Class[] |
|
120 | + */ |
|
121 | 121 | public function getClasses() |
122 | 122 | { |
123 | 123 | return $this->classes; |
124 | 124 | } |
125 | 125 | |
126 | - /** |
|
127 | - * @throws FileHelper_Exception |
|
128 | - */ |
|
126 | + /** |
|
127 | + * @throws FileHelper_Exception |
|
128 | + */ |
|
129 | 129 | protected function parseFile() |
130 | 130 | { |
131 | 131 | $code = file_get_contents($this->path); |
@@ -180,13 +180,13 @@ discard block |
||
180 | 180 | } |
181 | 181 | } |
182 | 182 | |
183 | - /** |
|
184 | - * Strips all whitespace from the string, replacing it with |
|
185 | - * regular spaces (newlines, tabs, etc.). |
|
186 | - * |
|
187 | - * @param string $string |
|
188 | - * @return string |
|
189 | - */ |
|
183 | + /** |
|
184 | + * Strips all whitespace from the string, replacing it with |
|
185 | + * regular spaces (newlines, tabs, etc.). |
|
186 | + * |
|
187 | + * @param string $string |
|
188 | + * @return string |
|
189 | + */ |
|
190 | 190 | protected function stripWhitespace(string $string) : string |
191 | 191 | { |
192 | 192 | return preg_replace('/[\s]/', ' ', $string); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | { |
52 | 52 | $this->path = realpath($path); |
53 | 53 | |
54 | - if($this->path === false) |
|
54 | + if ($this->path === false) |
|
55 | 55 | { |
56 | 56 | throw new FileHelper_Exception( |
57 | 57 | 'Cannot extract file information: file not found.', |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | { |
131 | 131 | $code = file_get_contents($this->path); |
132 | 132 | |
133 | - if($code === false) |
|
133 | + if ($code === false) |
|
134 | 134 | { |
135 | 135 | throw new FileHelper_Exception( |
136 | 136 | 'Cannot open file for parsing.', |
@@ -149,24 +149,24 @@ discard block |
||
149 | 149 | |
150 | 150 | $result = array(); |
151 | 151 | preg_match_all('/namespace[\s]+([^;]+);/six', $code, $result, PREG_PATTERN_ORDER); |
152 | - if(isset($result[0]) && isset($result[0][0])) { |
|
152 | + if (isset($result[0]) && isset($result[0][0])) { |
|
153 | 153 | $this->namespace = trim($result[1][0]); |
154 | 154 | } |
155 | 155 | |
156 | 156 | $result = array(); |
157 | 157 | preg_match_all('/(abstract|final)[\s]+class[\s]+([\sa-z0-9\\\\_,]+){|class[\s]+([\sa-z0-9\\\\_,]+){/six', $code, $result, PREG_PATTERN_ORDER); |
158 | 158 | |
159 | - if(!isset($result[0]) || !isset($result[0][0])) { |
|
159 | + if (!isset($result[0]) || !isset($result[0][0])) { |
|
160 | 160 | return; |
161 | 161 | } |
162 | 162 | |
163 | 163 | $indexes = array_keys($result[0]); |
164 | 164 | |
165 | - foreach($indexes as $idx) |
|
165 | + foreach ($indexes as $idx) |
|
166 | 166 | { |
167 | 167 | $keyword = $result[1][$idx]; |
168 | 168 | $declaration = $result[2][$idx]; |
169 | - if(empty($keyword)) { |
|
169 | + if (empty($keyword)) { |
|
170 | 170 | $declaration = $result[3][$idx]; |
171 | 171 | } |
172 | 172 |
@@ -22,51 +22,51 @@ discard block |
||
22 | 22 | */ |
23 | 23 | class FileHelper_PHPClassInfo_Class |
24 | 24 | { |
25 | - /** |
|
26 | - * @var FileHelper_PHPClassInfo |
|
27 | - */ |
|
25 | + /** |
|
26 | + * @var FileHelper_PHPClassInfo |
|
27 | + */ |
|
28 | 28 | protected $info; |
29 | 29 | |
30 | - /** |
|
31 | - * @var bool |
|
32 | - */ |
|
30 | + /** |
|
31 | + * @var bool |
|
32 | + */ |
|
33 | 33 | protected $abstract = false; |
34 | 34 | |
35 | - /** |
|
36 | - * @var bool |
|
37 | - */ |
|
35 | + /** |
|
36 | + * @var bool |
|
37 | + */ |
|
38 | 38 | protected $final = false; |
39 | 39 | |
40 | - /** |
|
41 | - * @var string |
|
42 | - */ |
|
40 | + /** |
|
41 | + * @var string |
|
42 | + */ |
|
43 | 43 | protected $extends = ''; |
44 | 44 | |
45 | - /** |
|
46 | - * @var string[] |
|
47 | - */ |
|
45 | + /** |
|
46 | + * @var string[] |
|
47 | + */ |
|
48 | 48 | protected $implements = array(); |
49 | 49 | |
50 | - /** |
|
51 | - * @var string |
|
52 | - */ |
|
50 | + /** |
|
51 | + * @var string |
|
52 | + */ |
|
53 | 53 | protected $name; |
54 | 54 | |
55 | - /** |
|
56 | - * @var string |
|
57 | - */ |
|
55 | + /** |
|
56 | + * @var string |
|
57 | + */ |
|
58 | 58 | protected $declaration; |
59 | 59 | |
60 | - /** |
|
61 | - * @var string |
|
62 | - */ |
|
60 | + /** |
|
61 | + * @var string |
|
62 | + */ |
|
63 | 63 | protected $keyword; |
64 | 64 | |
65 | - /** |
|
66 | - * @param FileHelper_PHPClassInfo $info The class info instance. |
|
67 | - * @param string $declaration The full class declaration, e.g. "class SomeName extends SomeOtherClass". |
|
68 | - * @param string $keyword The class keyword, if any, i.e. "abstract" or "final". |
|
69 | - */ |
|
65 | + /** |
|
66 | + * @param FileHelper_PHPClassInfo $info The class info instance. |
|
67 | + * @param string $declaration The full class declaration, e.g. "class SomeName extends SomeOtherClass". |
|
68 | + * @param string $keyword The class keyword, if any, i.e. "abstract" or "final". |
|
69 | + */ |
|
70 | 70 | public function __construct(FileHelper_PHPClassInfo $info, string $declaration, string $keyword) |
71 | 71 | { |
72 | 72 | $this->info = $info; |
@@ -76,31 +76,31 @@ discard block |
||
76 | 76 | $this->analyzeCode(); |
77 | 77 | } |
78 | 78 | |
79 | - /** |
|
80 | - * Check if this class is a subclass of the specified |
|
81 | - * class name. |
|
82 | - * |
|
83 | - * @param string $className |
|
84 | - * @return bool |
|
85 | - */ |
|
79 | + /** |
|
80 | + * Check if this class is a subclass of the specified |
|
81 | + * class name. |
|
82 | + * |
|
83 | + * @param string $className |
|
84 | + * @return bool |
|
85 | + */ |
|
86 | 86 | public function isSublassOf(string $className) : bool |
87 | 87 | { |
88 | 88 | return is_subclass_of($this->getNameNS(), $className); |
89 | 89 | } |
90 | 90 | |
91 | - /** |
|
92 | - * The class name without namespace. |
|
93 | - * @return string |
|
94 | - */ |
|
91 | + /** |
|
92 | + * The class name without namespace. |
|
93 | + * @return string |
|
94 | + */ |
|
95 | 95 | public function getName() : string |
96 | 96 | { |
97 | 97 | return $this->name; |
98 | 98 | } |
99 | 99 | |
100 | - /** |
|
101 | - * The absolute class name with namespace (if any). |
|
102 | - * @return string |
|
103 | - */ |
|
100 | + /** |
|
101 | + * The absolute class name with namespace (if any). |
|
102 | + * @return string |
|
103 | + */ |
|
104 | 104 | public function getNameNS() : string |
105 | 105 | { |
106 | 106 | $name = $this->getName(); |
@@ -112,48 +112,48 @@ discard block |
||
112 | 112 | return $name; |
113 | 113 | } |
114 | 114 | |
115 | - /** |
|
116 | - * Whether it is an abstract class. |
|
117 | - * @return bool |
|
118 | - */ |
|
115 | + /** |
|
116 | + * Whether it is an abstract class. |
|
117 | + * @return bool |
|
118 | + */ |
|
119 | 119 | public function isAbstract() : bool |
120 | 120 | { |
121 | 121 | return $this->abstract; |
122 | 122 | } |
123 | 123 | |
124 | - /** |
|
125 | - * Whether it is a final class. |
|
126 | - * @return bool |
|
127 | - */ |
|
124 | + /** |
|
125 | + * Whether it is a final class. |
|
126 | + * @return bool |
|
127 | + */ |
|
128 | 128 | public function isFinal() : bool |
129 | 129 | { |
130 | 130 | return $this->final; |
131 | 131 | } |
132 | 132 | |
133 | - /** |
|
134 | - * The name of the class that this class extends (with namespace, if specified). |
|
135 | - * @return string |
|
136 | - */ |
|
133 | + /** |
|
134 | + * The name of the class that this class extends (with namespace, if specified). |
|
135 | + * @return string |
|
136 | + */ |
|
137 | 137 | public function getExtends() : string |
138 | 138 | { |
139 | 139 | return $this->extends; |
140 | 140 | } |
141 | 141 | |
142 | - /** |
|
143 | - * A list of interfaces the class implements, if any. |
|
144 | - * @return array |
|
145 | - */ |
|
142 | + /** |
|
143 | + * A list of interfaces the class implements, if any. |
|
144 | + * @return array |
|
145 | + */ |
|
146 | 146 | public function getImplements() : array |
147 | 147 | { |
148 | 148 | return $this->implements; |
149 | 149 | } |
150 | 150 | |
151 | - /** |
|
152 | - * The class declaration string, with normalized spaces and sorted interface names. |
|
153 | - * NOTE: does not include the keyword "abstract" or "final". |
|
154 | - * |
|
155 | - * @return string |
|
156 | - */ |
|
151 | + /** |
|
152 | + * The class declaration string, with normalized spaces and sorted interface names. |
|
153 | + * NOTE: does not include the keyword "abstract" or "final". |
|
154 | + * |
|
155 | + * @return string |
|
156 | + */ |
|
157 | 157 | public function getDeclaration() : string |
158 | 158 | { |
159 | 159 | $parts = array(); |
@@ -173,10 +173,10 @@ discard block |
||
173 | 173 | return implode(' ', $parts); |
174 | 174 | } |
175 | 175 | |
176 | - /** |
|
177 | - * The keyword before "class", e.g. "abstract". |
|
178 | - * @return string |
|
179 | - */ |
|
176 | + /** |
|
177 | + * The keyword before "class", e.g. "abstract". |
|
178 | + * @return string |
|
179 | + */ |
|
180 | 180 | public function getKeyword() : string |
181 | 181 | { |
182 | 182 | return $this->keyword; |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | { |
106 | 106 | $name = $this->getName(); |
107 | 107 | |
108 | - if($this->info->hasNamespace()) { |
|
108 | + if ($this->info->hasNamespace()) { |
|
109 | 109 | $name = $this->info->getNamespace().'\\'.$this->name; |
110 | 110 | } |
111 | 111 | |
@@ -160,12 +160,12 @@ discard block |
||
160 | 160 | $parts[] = 'class'; |
161 | 161 | $parts[] = $this->getName(); |
162 | 162 | |
163 | - if(!empty($this->extends)) { |
|
163 | + if (!empty($this->extends)) { |
|
164 | 164 | $parts[] = 'extends'; |
165 | 165 | $parts[] = $this->extends; |
166 | 166 | } |
167 | 167 | |
168 | - if(!empty($this->implements)) { |
|
168 | + if (!empty($this->implements)) { |
|
169 | 169 | $parts[] = 'implements'; |
170 | 170 | $parts[] = implode(', ', $this->implements); |
171 | 171 | } |
@@ -184,9 +184,9 @@ discard block |
||
184 | 184 | |
185 | 185 | protected function analyzeCode() |
186 | 186 | { |
187 | - if($this->keyword == 'abstract') { |
|
187 | + if ($this->keyword == 'abstract') { |
|
188 | 188 | $this->abstract = true; |
189 | - } else if($this->keyword == 'final') { |
|
189 | + } else if ($this->keyword == 'final') { |
|
190 | 190 | $this->final = true; |
191 | 191 | } |
192 | 192 | |
@@ -203,16 +203,16 @@ discard block |
||
203 | 203 | |
204 | 204 | $tokenName = 'none'; |
205 | 205 | |
206 | - foreach($parts as $part) |
|
206 | + foreach ($parts as $part) |
|
207 | 207 | { |
208 | 208 | $part = str_replace(',', '', $part); |
209 | 209 | $part = trim($part); |
210 | - if(empty($part)) { |
|
210 | + if (empty($part)) { |
|
211 | 211 | continue; |
212 | 212 | } |
213 | 213 | |
214 | 214 | $name = strtolower($part); |
215 | - if($name == 'extends' || $name == 'implements') { |
|
215 | + if ($name == 'extends' || $name == 'implements') { |
|
216 | 216 | $tokenName = $name; |
217 | 217 | continue; |
218 | 218 | } |
@@ -222,13 +222,13 @@ discard block |
||
222 | 222 | |
223 | 223 | $this->implements = $tokens['implements']; |
224 | 224 | |
225 | - if(!empty($this->implements)) { |
|
225 | + if (!empty($this->implements)) { |
|
226 | 226 | usort($this->implements, function(string $a, string $b) { |
227 | 227 | return strnatcasecmp($a, $b); |
228 | 228 | }); |
229 | 229 | } |
230 | 230 | |
231 | - if(!empty($tokens['extends'])) { |
|
231 | + if (!empty($tokens['extends'])) { |
|
232 | 232 | $this->extends = $tokens['extends'][0]; |
233 | 233 | } |
234 | 234 | } |
@@ -18,23 +18,23 @@ discard block |
||
18 | 18 | |
19 | 19 | public function __construct(array $size) |
20 | 20 | { |
21 | - if(!isset($size['width'])) { |
|
21 | + if (!isset($size['width'])) { |
|
22 | 22 | $size['width'] = $size[0]; |
23 | 23 | } |
24 | 24 | |
25 | - if(!isset($size['height'])) { |
|
25 | + if (!isset($size['height'])) { |
|
26 | 26 | $size['height'] = $size[1]; |
27 | 27 | } |
28 | 28 | |
29 | - if(!isset($size[0])) { |
|
29 | + if (!isset($size[0])) { |
|
30 | 30 | $size[0] = $size['width']; |
31 | 31 | } |
32 | 32 | |
33 | - if(!isset($size[1])) { |
|
33 | + if (!isset($size[1])) { |
|
34 | 34 | $size[1] = $size['height']; |
35 | 35 | } |
36 | 36 | |
37 | - if(!isset($size['channels'])) { |
|
37 | + if (!isset($size['channels'])) { |
|
38 | 38 | $size['channels'] = 1; |
39 | 39 | } |
40 | 40 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | |
69 | 69 | public function offsetGet($offset) |
70 | 70 | { |
71 | - if(isset($this->size[$offset])) { |
|
71 | + if (isset($this->size[$offset])) { |
|
72 | 72 | return $this->size[$offset]; |
73 | 73 | } |
74 | 74 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | public function offsetSet($offset, $value) |
79 | 79 | { |
80 | - if(is_null($offset)) { |
|
80 | + if (is_null($offset)) { |
|
81 | 81 | $this->size[] = $value; |
82 | 82 | } else { |
83 | 83 | $this->size[$offset] = $value; |
@@ -7,9 +7,9 @@ |
||
7 | 7 | * @author Sebastian Mordziol <[email protected]> |
8 | 8 | */ |
9 | 9 | |
10 | - /** |
|
11 | - * Examples environment config |
|
12 | - */ |
|
10 | + /** |
|
11 | + * Examples environment config |
|
12 | + */ |
|
13 | 13 | require_once '../prepend.php'; |
14 | 14 | |
15 | 15 | use function AppUtils\parseURL; |
@@ -42,7 +42,7 @@ |
||
42 | 42 | <br> |
43 | 43 | <?php |
44 | 44 | |
45 | - foreach($urls as $url) |
|
45 | + foreach ($urls as $url) |
|
46 | 46 | { |
47 | 47 | $info = parseURL($url); |
48 | 48 |