@@ -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; |