@@ -33,19 +33,19 @@ |
||
33 | 33 | $this->match = $matchedString; |
34 | 34 | } |
35 | 35 | |
36 | - /** |
|
37 | - * The zero-based start position of the string in the haystack. |
|
38 | - * @return int |
|
39 | - */ |
|
36 | + /** |
|
37 | + * The zero-based start position of the string in the haystack. |
|
38 | + * @return int |
|
39 | + */ |
|
40 | 40 | public function getPosition() : int |
41 | 41 | { |
42 | 42 | return $this->position; |
43 | 43 | } |
44 | 44 | |
45 | - /** |
|
46 | - * The exact string that was matched, respecting the case as found in needle. |
|
47 | - * @return string |
|
48 | - */ |
|
45 | + /** |
|
46 | + * The exact string that was matched, respecting the case as found in needle. |
|
47 | + * @return string |
|
48 | + */ |
|
49 | 49 | public function getMatchedString() : string |
50 | 50 | { |
51 | 51 | return $this->match; |
@@ -6,9 +6,9 @@ |
||
6 | 6 | { |
7 | 7 | protected $xml; |
8 | 8 | |
9 | - /** |
|
10 | - * @var \LibXMLError |
|
11 | - */ |
|
9 | + /** |
|
10 | + * @var \LibXMLError |
|
11 | + */ |
|
12 | 12 | protected $nativeError; |
13 | 13 | |
14 | 14 | public function __construct(XMLHelper_SimpleXML $xml, \LibXMLError $nativeError) |
@@ -41,14 +41,14 @@ discard block |
||
41 | 41 | { |
42 | 42 | const ERROR_FAILED_CONVERTING_TO_JSON = 37901; |
43 | 43 | |
44 | - /** |
|
45 | - * @var \SimpleXMLElement |
|
46 | - */ |
|
44 | + /** |
|
45 | + * @var \SimpleXMLElement |
|
46 | + */ |
|
47 | 47 | protected $xml; |
48 | 48 | |
49 | - /** |
|
50 | - * @var string |
|
51 | - */ |
|
49 | + /** |
|
50 | + * @var string |
|
51 | + */ |
|
52 | 52 | protected $json; |
53 | 53 | |
54 | 54 | protected function __construct(\SimpleXMLElement $element) |
@@ -56,24 +56,24 @@ discard block |
||
56 | 56 | $this->xml = $element; |
57 | 57 | } |
58 | 58 | |
59 | - /** |
|
60 | - * Factory method: creates a converter from an XML file on disk. |
|
61 | - * |
|
62 | - * @param string $path |
|
63 | - * @return \AppUtils\XMLHelper_Converter |
|
64 | - */ |
|
59 | + /** |
|
60 | + * Factory method: creates a converter from an XML file on disk. |
|
61 | + * |
|
62 | + * @param string $path |
|
63 | + * @return \AppUtils\XMLHelper_Converter |
|
64 | + */ |
|
65 | 65 | public static function fromFile(string $path) |
66 | 66 | { |
67 | 67 | $xmlString = file_get_contents($path); |
68 | 68 | return self::fromString($xmlString); |
69 | 69 | } |
70 | 70 | |
71 | - /** |
|
72 | - * Factory method: creates a converter from an XML string. |
|
73 | - * |
|
74 | - * @param string $xmlString |
|
75 | - * @return \AppUtils\XMLHelper_Converter |
|
76 | - */ |
|
71 | + /** |
|
72 | + * Factory method: creates a converter from an XML string. |
|
73 | + * |
|
74 | + * @param string $xmlString |
|
75 | + * @return \AppUtils\XMLHelper_Converter |
|
76 | + */ |
|
77 | 77 | public static function fromString(string $xmlString) |
78 | 78 | { |
79 | 79 | $element = new \SimpleXMLElement($xmlString); |
@@ -81,36 +81,36 @@ discard block |
||
81 | 81 | return self::fromElement($element); |
82 | 82 | } |
83 | 83 | |
84 | - /** |
|
85 | - * Factory method: creates a converter from an existing SimpleXMLElement instance. |
|
86 | - * |
|
87 | - * @param \SimpleXMLElement $element |
|
88 | - * @return \AppUtils\XMLHelper_Converter |
|
89 | - */ |
|
84 | + /** |
|
85 | + * Factory method: creates a converter from an existing SimpleXMLElement instance. |
|
86 | + * |
|
87 | + * @param \SimpleXMLElement $element |
|
88 | + * @return \AppUtils\XMLHelper_Converter |
|
89 | + */ |
|
90 | 90 | public static function fromElement(\SimpleXMLElement $element) |
91 | 91 | { |
92 | 92 | $obj = new XMLHelper_Converter($element); |
93 | 93 | return $obj; |
94 | 94 | } |
95 | 95 | |
96 | - /** |
|
97 | - * Factory method: creates a converter from an existing SimpleXMLElement instance. |
|
98 | - * |
|
99 | - * @param \DOMElement $element |
|
100 | - * @return \AppUtils\XMLHelper_Converter |
|
101 | - */ |
|
96 | + /** |
|
97 | + * Factory method: creates a converter from an existing SimpleXMLElement instance. |
|
98 | + * |
|
99 | + * @param \DOMElement $element |
|
100 | + * @return \AppUtils\XMLHelper_Converter |
|
101 | + */ |
|
102 | 102 | public static function fromDOMElement(\DOMElement $element) |
103 | 103 | { |
104 | 104 | $obj = new XMLHelper_Converter(simplexml_import_dom($element)); |
105 | 105 | return $obj; |
106 | 106 | } |
107 | 107 | |
108 | - /** |
|
109 | - * Converts the XML to JSON. |
|
110 | - * |
|
111 | - * @throws XMLHelper_Exception |
|
112 | - * @return string |
|
113 | - */ |
|
108 | + /** |
|
109 | + * Converts the XML to JSON. |
|
110 | + * |
|
111 | + * @throws XMLHelper_Exception |
|
112 | + * @return string |
|
113 | + */ |
|
114 | 114 | public function toJSON() : string |
115 | 115 | { |
116 | 116 | if(isset($this->json)) { |
@@ -138,11 +138,11 @@ discard block |
||
138 | 138 | ); |
139 | 139 | } |
140 | 140 | |
141 | - /** |
|
142 | - * Converts the XML to an associative array. |
|
143 | - * @return array |
|
144 | - * @throws XMLHelper_Exception |
|
145 | - */ |
|
141 | + /** |
|
142 | + * Converts the XML to an associative array. |
|
143 | + * @return array |
|
144 | + * @throws XMLHelper_Exception |
|
145 | + */ |
|
146 | 146 | public function toArray() : array |
147 | 147 | { |
148 | 148 | $json = $this->toJSON(); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function toJSON() : string |
115 | 115 | { |
116 | - if(isset($this->json)) { |
|
116 | + if (isset($this->json)) { |
|
117 | 117 | return $this->json; |
118 | 118 | } |
119 | 119 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | |
124 | 124 | unset($this->xml); |
125 | 125 | |
126 | - if($this->json !== false) { |
|
126 | + if ($this->json !== false) { |
|
127 | 127 | return $this->json; |
128 | 128 | } |
129 | 129 |
@@ -11,27 +11,27 @@ |
||
11 | 11 | |
12 | 12 | protected $errors = array(); |
13 | 13 | |
14 | - /** |
|
15 | - * Creates a simplexml instance from an XML string. |
|
16 | - * |
|
17 | - * NOTE: returns false in case of a fatal error. |
|
18 | - * |
|
19 | - * @param string $string |
|
20 | - * @return \SimpleXMLElement|bool |
|
21 | - */ |
|
14 | + /** |
|
15 | + * Creates a simplexml instance from an XML string. |
|
16 | + * |
|
17 | + * NOTE: returns false in case of a fatal error. |
|
18 | + * |
|
19 | + * @param string $string |
|
20 | + * @return \SimpleXMLElement|bool |
|
21 | + */ |
|
22 | 22 | public function loadString($string) |
23 | 23 | { |
24 | 24 | return $this->load('string', $string); |
25 | 25 | } |
26 | 26 | |
27 | - /** |
|
28 | - * Creates a simplexml instance from an XML file. |
|
29 | - * |
|
30 | - * NOTE: returns false in case of a fatal error. |
|
31 | - * |
|
32 | - * @param string $file |
|
33 | - * @return \SimpleXMLElement|bool |
|
34 | - */ |
|
27 | + /** |
|
28 | + * Creates a simplexml instance from an XML file. |
|
29 | + * |
|
30 | + * NOTE: returns false in case of a fatal error. |
|
31 | + * |
|
32 | + * @param string $file |
|
33 | + * @return \SimpleXMLElement|bool |
|
34 | + */ |
|
35 | 35 | public function loadFile($file) |
36 | 36 | { |
37 | 37 | return $this->load('file', $file); |
@@ -52,7 +52,7 @@ |
||
52 | 52 | // add any errors that were triggered, using the |
53 | 53 | // error wrappers. |
54 | 54 | $errors = libxml_get_errors(); |
55 | - foreach($errors as $error) { |
|
55 | + foreach ($errors as $error) { |
|
56 | 56 | $this->errors[] = new XMLHelper_SimpleXML_Error($this, $error); |
57 | 57 | } |
58 | 58 |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | public function addLimitParam(string $name) : Request_URLComparer |
33 | 33 | { |
34 | - if(!in_array($name, $this->limitParams)) { |
|
34 | + if (!in_array($name, $this->limitParams)) { |
|
35 | 35 | $this->limitParams[] = $name; |
36 | 36 | } |
37 | 37 | |
@@ -40,14 +40,14 @@ discard block |
||
40 | 40 | |
41 | 41 | public function addLimitParams(array $names) : Request_URLComparer |
42 | 42 | { |
43 | - foreach($names as $name) { |
|
43 | + foreach ($names as $name) { |
|
44 | 44 | $this->addLimitParam($name); |
45 | 45 | } |
46 | 46 | |
47 | 47 | return $this; |
48 | 48 | } |
49 | 49 | |
50 | - public function setIgnoreFragment(bool $ignore=true) : Request_URLComparer |
|
50 | + public function setIgnoreFragment(bool $ignore = true) : Request_URLComparer |
|
51 | 51 | { |
52 | 52 | $this->ignoreFragment = $ignore; |
53 | 53 | return $this; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | protected function init() |
57 | 57 | { |
58 | - if(isset($this->isMatch)) { |
|
58 | + if (isset($this->isMatch)) { |
|
59 | 59 | return; |
60 | 60 | } |
61 | 61 | |
@@ -77,25 +77,25 @@ discard block |
||
77 | 77 | 'query' |
78 | 78 | ); |
79 | 79 | |
80 | - if(!$this->ignoreFragment) { |
|
80 | + if (!$this->ignoreFragment) { |
|
81 | 81 | $keys[] = 'fragment'; |
82 | 82 | } |
83 | 83 | |
84 | - foreach($keys as $key) |
|
84 | + foreach ($keys as $key) |
|
85 | 85 | { |
86 | 86 | $sVal = ''; |
87 | 87 | $tVal = ''; |
88 | 88 | |
89 | - if(isset($sInfo[$key])) { $sVal = $sInfo[$key]; } |
|
90 | - if(isset($tInfo[$key])) { $tVal = $tInfo[$key]; } |
|
89 | + if (isset($sInfo[$key])) { $sVal = $sInfo[$key]; } |
|
90 | + if (isset($tInfo[$key])) { $tVal = $tInfo[$key]; } |
|
91 | 91 | |
92 | 92 | $filter = 'filter_'.$key; |
93 | - if(method_exists($this, $filter)) { |
|
93 | + if (method_exists($this, $filter)) { |
|
94 | 94 | $sVal = $this->$filter($sVal); |
95 | 95 | $tVal = $this->$filter($tVal); |
96 | 96 | } |
97 | 97 | |
98 | - if($sVal !== $tVal) { |
|
98 | + if ($sVal !== $tVal) { |
|
99 | 99 | return false; |
100 | 100 | } |
101 | 101 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | protected function filter_path(string $path) : string |
107 | 107 | { |
108 | 108 | // fix double slashes in URLs |
109 | - while(stristr($path, '//')) { |
|
109 | + while (stristr($path, '//')) { |
|
110 | 110 | $path = str_replace('//', '/', $path); |
111 | 111 | } |
112 | 112 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | protected function filter_query(string $query) : string |
117 | 117 | { |
118 | - if(empty($query)) { |
|
118 | + if (empty($query)) { |
|
119 | 119 | return ''; |
120 | 120 | } |
121 | 121 | |
@@ -123,13 +123,13 @@ discard block |
||
123 | 123 | |
124 | 124 | ksort($params); |
125 | 125 | |
126 | - if(!empty($this->limitParams)) |
|
126 | + if (!empty($this->limitParams)) |
|
127 | 127 | { |
128 | 128 | $keep = array(); |
129 | 129 | |
130 | - foreach($this->limitParams as $name) |
|
130 | + foreach ($this->limitParams as $name) |
|
131 | 131 | { |
132 | - if(isset($params[$name])) { |
|
132 | + if (isset($params[$name])) { |
|
133 | 133 | $keep[$name] = $params[$name]; |
134 | 134 | } |
135 | 135 | } |
@@ -42,10 +42,10 @@ discard block |
||
42 | 42 | |
43 | 43 | const REGEX_MD5 = '/^[a-f0-9]{32}$/i'; |
44 | 44 | |
45 | - /** |
|
46 | - * @var string |
|
47 | - * @see https://en.wikipedia.org/wiki/Email_address#Local-part |
|
48 | - */ |
|
45 | + /** |
|
46 | + * @var string |
|
47 | + * @see https://en.wikipedia.org/wiki/Email_address#Local-part |
|
48 | + */ |
|
49 | 49 | const REGEX_EMAIL = '/[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/i'; |
50 | 50 | |
51 | 51 | const REGEX_PHONE = '/\A[+0-9][0-9 +\-()]+\z/m'; |
@@ -97,13 +97,13 @@ discard block |
||
97 | 97 | */ |
98 | 98 | const REGEX_IS_HTML = '%<{0,1}[a-z\/][\s\S]*>|<[a-z\/][\s\S]*>{0,1}%i'; |
99 | 99 | |
100 | - /** |
|
101 | - * Hexadecimal color codes. Allows the following formats: |
|
102 | - * |
|
103 | - * FFFFFF |
|
104 | - * FFF |
|
105 | - * |
|
106 | - * @var string |
|
107 | - */ |
|
100 | + /** |
|
101 | + * Hexadecimal color codes. Allows the following formats: |
|
102 | + * |
|
103 | + * FFFFFF |
|
104 | + * FFF |
|
105 | + * |
|
106 | + * @var string |
|
107 | + */ |
|
108 | 108 | const REGEX_HEX_COLOR_CODE = '/\A(?:[0-9a-fA-F]{6}|[0-9a-fA-F]{3})\z/iU'; |
109 | 109 | } |
@@ -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 | } |
@@ -32,25 +32,25 @@ discard block |
||
32 | 32 | self::TYPE_CALLABLE => 'cf5e20' |
33 | 33 | ); |
34 | 34 | |
35 | - /** |
|
36 | - * @var string |
|
37 | - */ |
|
35 | + /** |
|
36 | + * @var string |
|
37 | + */ |
|
38 | 38 | protected $string; |
39 | 39 | |
40 | - /** |
|
41 | - * @var mixed |
|
42 | - */ |
|
40 | + /** |
|
41 | + * @var mixed |
|
42 | + */ |
|
43 | 43 | protected $value; |
44 | 44 | |
45 | - /** |
|
46 | - * @var string |
|
47 | - */ |
|
45 | + /** |
|
46 | + * @var string |
|
47 | + */ |
|
48 | 48 | protected $type; |
49 | 49 | |
50 | - /** |
|
51 | - * @param mixed $value |
|
52 | - * @param array|null $serialized |
|
53 | - */ |
|
50 | + /** |
|
51 | + * @param mixed $value |
|
52 | + * @param array|null $serialized |
|
53 | + */ |
|
54 | 54 | public function __construct($value, $serialized=null) |
55 | 55 | { |
56 | 56 | if(is_array($serialized)) |
@@ -63,26 +63,26 @@ discard block |
||
63 | 63 | } |
64 | 64 | } |
65 | 65 | |
66 | - /** |
|
67 | - * Creates a new variable info instance from a PHP variable |
|
68 | - * of any type. |
|
69 | - * |
|
70 | - * @param mixed $variable |
|
71 | - * @return VariableInfo |
|
72 | - */ |
|
66 | + /** |
|
67 | + * Creates a new variable info instance from a PHP variable |
|
68 | + * of any type. |
|
69 | + * |
|
70 | + * @param mixed $variable |
|
71 | + * @return VariableInfo |
|
72 | + */ |
|
73 | 73 | public static function fromVariable($variable) : VariableInfo |
74 | 74 | { |
75 | 75 | return new VariableInfo($variable); |
76 | 76 | } |
77 | 77 | |
78 | - /** |
|
79 | - * Restores a variable info instance using a previously serialized |
|
80 | - * array using the serialize() method. |
|
81 | - * |
|
82 | - * @param array $serialized |
|
83 | - * @return VariableInfo |
|
84 | - * @see VariableInfo::serialize() |
|
85 | - */ |
|
78 | + /** |
|
79 | + * Restores a variable info instance using a previously serialized |
|
80 | + * array using the serialize() method. |
|
81 | + * |
|
82 | + * @param array $serialized |
|
83 | + * @return VariableInfo |
|
84 | + * @see VariableInfo::serialize() |
|
85 | + */ |
|
86 | 86 | public static function fromSerialized(array $serialized) : VariableInfo |
87 | 87 | { |
88 | 88 | return new VariableInfo(null, $serialized); |
@@ -108,12 +108,12 @@ discard block |
||
108 | 108 | $this->string = $this->_toString(); |
109 | 109 | } |
110 | 110 | |
111 | - /** |
|
112 | - * The variable type - this is the same string that |
|
113 | - * is returned by the PHP function `gettype`. |
|
114 | - * |
|
115 | - * @return string |
|
116 | - */ |
|
111 | + /** |
|
112 | + * The variable type - this is the same string that |
|
113 | + * is returned by the PHP function `gettype`. |
|
114 | + * |
|
115 | + * @return string |
|
116 | + */ |
|
117 | 117 | public function getType() : string |
118 | 118 | { |
119 | 119 | return $this->type; |
@@ -127,13 +127,13 @@ discard block |
||
127 | 127 | ); |
128 | 128 | } |
129 | 129 | |
130 | - /** |
|
131 | - * Whether to prepend the variable type before the value, |
|
132 | - * like the var_dump function. Example: <code>string "Some text"</code>. |
|
133 | - * |
|
134 | - * @param bool $enable |
|
135 | - * @return VariableInfo |
|
136 | - */ |
|
130 | + /** |
|
131 | + * Whether to prepend the variable type before the value, |
|
132 | + * like the var_dump function. Example: <code>string "Some text"</code>. |
|
133 | + * |
|
134 | + * @param bool $enable |
|
135 | + * @return VariableInfo |
|
136 | + */ |
|
137 | 137 | public function enableType(bool $enable=true) : VariableInfo |
138 | 138 | { |
139 | 139 | return $this->setOption('prepend-type', $enable); |
@@ -203,12 +203,12 @@ discard block |
||
203 | 203 | return $converted; |
204 | 204 | } |
205 | 205 | |
206 | - /** |
|
207 | - * Converts an array to a string. |
|
208 | - * @return string |
|
209 | - * |
|
210 | - * @todo Create custom dump implementation, using VariableInfo instances. |
|
211 | - */ |
|
206 | + /** |
|
207 | + * Converts an array to a string. |
|
208 | + * @return string |
|
209 | + * |
|
210 | + * @todo Create custom dump implementation, using VariableInfo instances. |
|
211 | + */ |
|
212 | 212 | protected function toString_array() : string |
213 | 213 | { |
214 | 214 | $result = json_encode($this->value, JSON_PRETTY_PRINT); |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | * @param mixed $value |
52 | 52 | * @param array|null $serialized |
53 | 53 | */ |
54 | - public function __construct($value, $serialized=null) |
|
54 | + public function __construct($value, $serialized = null) |
|
55 | 55 | { |
56 | - if(is_array($serialized)) |
|
56 | + if (is_array($serialized)) |
|
57 | 57 | { |
58 | 58 | $this->parseSerialized($serialized); |
59 | 59 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $this->value = $value; |
102 | 102 | $this->type = strtolower(gettype($value)); |
103 | 103 | |
104 | - if(is_array($value) && is_callable($value)) { |
|
104 | + if (is_array($value) && is_callable($value)) { |
|
105 | 105 | $this->type = self::TYPE_CALLABLE; |
106 | 106 | } |
107 | 107 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * @param bool $enable |
135 | 135 | * @return VariableInfo |
136 | 136 | */ |
137 | - public function enableType(bool $enable=true) : VariableInfo |
|
137 | + public function enableType(bool $enable = true) : VariableInfo |
|
138 | 138 | { |
139 | 139 | return $this->setOption('prepend-type', $enable); |
140 | 140 | } |
@@ -143,9 +143,9 @@ discard block |
||
143 | 143 | { |
144 | 144 | $converted = $this->string; |
145 | 145 | |
146 | - if($this->getOption('prepend-type') === true && !$this->isNull()) |
|
146 | + if ($this->getOption('prepend-type') === true && !$this->isNull()) |
|
147 | 147 | { |
148 | - if($this->isString()) |
|
148 | + if ($this->isString()) |
|
149 | 149 | { |
150 | 150 | $converted = '"'.$converted.'"'; |
151 | 151 | } |
@@ -177,16 +177,16 @@ discard block |
||
177 | 177 | |
178 | 178 | $converted = $this->$varMethod(); |
179 | 179 | |
180 | - if($format === 'HTML') |
|
180 | + if ($format === 'HTML') |
|
181 | 181 | { |
182 | 182 | $converted = '<span style="color:#'.self::$colors[$type].'" class="variable-value-'.$this->type.'">'.$converted.'</span>'; |
183 | 183 | } |
184 | 184 | |
185 | - if($this->getOption('prepend-type') === true && !$this->isNull()) |
|
185 | + if ($this->getOption('prepend-type') === true && !$this->isNull()) |
|
186 | 186 | { |
187 | 187 | $typeLabel = $type; |
188 | 188 | |
189 | - switch($format) |
|
189 | + switch ($format) |
|
190 | 190 | { |
191 | 191 | case 'HTML': |
192 | 192 | $typeLabel = '<span style="color:#1c2eb1" class="variable-type">'.$type.'</span> '; |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | |
216 | 216 | // the array may not be encodable - for example if it contains |
217 | 217 | // broken unicode characters. |
218 | - if(is_string($result) && $result !== '') { |
|
218 | + if (is_string($result) && $result !== '') { |
|
219 | 219 | return $result; |
220 | 220 | } |
221 | 221 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | { |
227 | 227 | $string = ''; |
228 | 228 | |
229 | - if(is_string($this->value[0])) { |
|
229 | + if (is_string($this->value[0])) { |
|
230 | 230 | $string .= $this->value[0].'::'; |
231 | 231 | } else { |
232 | 232 | $string .= get_class($this->value[0]).'->'; |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | str_replace(' ', '-', $this->type) |
354 | 354 | ); |
355 | 355 | |
356 | - if($this->getOption('prepend-type') === true && !$this->isNull()) |
|
356 | + if ($this->getOption('prepend-type') === true && !$this->isNull()) |
|
357 | 357 | { |
358 | 358 | $typeLabel = '<span style="color:#1c2eb1" class="variable-type">'.$this->type.'</span> '; |
359 | 359 | $converted = $typeLabel.' '.$converted; |
@@ -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 = "'"; |