@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $dumper->setColors(false); |
34 | 34 | $cloner = new VarCloner(); |
35 | 35 | $cloner->addCasters(array( |
36 | - ':stream' => function ($res, $a) { |
|
36 | + ':stream' => function($res, $a) { |
|
37 | 37 | unset($a['uri'], $a['wrapper_data']); |
38 | 38 | |
39 | 39 | return $a; |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | $dumper->setColors(false); |
273 | 273 | $cloner = new VarCloner(); |
274 | 274 | $cloner->addCasters(array( |
275 | - ':stream' => function ($res, $a) { |
|
275 | + ':stream' => function($res, $a) { |
|
276 | 276 | unset($a['wrapper_data']); |
277 | 277 | |
278 | 278 | return $a; |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | unset($var[0]); |
407 | 407 | $out = ''; |
408 | 408 | |
409 | - $dumper = new CliDumper(function ($line, $depth) use (&$out) { |
|
409 | + $dumper = new CliDumper(function($line, $depth) use (&$out) { |
|
410 | 410 | if ($depth >= 0) { |
411 | 411 | $out .= str_repeat(' ', $depth).$line."\n"; |
412 | 412 | } |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | |
458 | 458 | $data = $cloner->cloneVar($var)->withMaxDepth(3); |
459 | 459 | $out = ''; |
460 | - $dumper->dump($data, function ($line, $depth) use (&$out) { |
|
460 | + $dumper->dump($data, function($line, $depth) use (&$out) { |
|
461 | 461 | if ($depth >= 0) { |
462 | 462 | $out .= str_repeat(' ', $depth).$line."\n"; |
463 | 463 | } |
@@ -239,10 +239,10 @@ |
||
239 | 239 | public function testCaster() |
240 | 240 | { |
241 | 241 | $cloner = new VarCloner(array( |
242 | - '*' => function ($obj, $array) { |
|
242 | + '*' => function($obj, $array) { |
|
243 | 243 | return array('foo' => 123); |
244 | 244 | }, |
245 | - __CLASS__ => function ($obj, $array) { |
|
245 | + __CLASS__ => function($obj, $array) { |
|
246 | 246 | ++$array['foo']; |
247 | 247 | |
248 | 248 | return $array; |
@@ -29,7 +29,7 @@ |
||
29 | 29 | $dumper->setDumpBoundaries('<bar>', '</bar>'); |
30 | 30 | $cloner = new VarCloner(); |
31 | 31 | $cloner->addCasters(array( |
32 | - ':stream' => function ($res, $a) { |
|
32 | + ':stream' => function($res, $a) { |
|
33 | 33 | unset($a['uri'], $a['wrapper_data']); |
34 | 34 | |
35 | 35 | return $a; |
@@ -21,8 +21,8 @@ |
||
21 | 21 | '[]' => array(), |
22 | 22 | 'res' => $g, |
23 | 23 | 'obj' => $foo, |
24 | - 'closure' => function ($a, \PDO &$b = null) {}, |
|
25 | - 'line' => __LINE__ - 1, |
|
24 | + 'closure' => function($a, \PDO &$b = null) {}, |
|
25 | + 'line' => __LINE__ -1, |
|
26 | 26 | 'nobj' => array((object) array()), |
27 | 27 | ); |
28 | 28 |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | public function testClosureCaster() |
65 | 65 | { |
66 | 66 | $a = $b = 123; |
67 | - $var = function ($x) use ($a, &$b) {}; |
|
67 | + $var = function($x) use ($a, &$b) {}; |
|
68 | 68 | |
69 | 69 | $this->assertDumpMatchesFormat( |
70 | 70 | <<<EOTXT |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | public function testReturnType() |
128 | 128 | { |
129 | 129 | $f = eval('return function ():int {};'); |
130 | - $line = __LINE__ - 1; |
|
130 | + $line = __LINE__ -1; |
|
131 | 131 | |
132 | 132 | $this->assertDumpMatchesFormat( |
133 | 133 | <<<EOTXT |
@@ -30,7 +30,7 @@ |
||
30 | 30 | if (null === self::$handler) { |
31 | 31 | $cloner = new VarCloner(); |
32 | 32 | $dumper = 'cli' === PHP_SAPI ? new CliDumper() : new HtmlDumper(); |
33 | - self::$handler = function ($var) use ($cloner, $dumper) { |
|
33 | + self::$handler = function($var) use ($cloner, $dumper) { |
|
34 | 34 | $dumper->dump($cloner->cloneVar($var)); |
35 | 35 | }; |
36 | 36 | } |
@@ -25,21 +25,21 @@ discard block |
||
25 | 25 | protected function doClone($var) |
26 | 26 | { |
27 | 27 | $useExt = $this->useExt; |
28 | - $len = 1; // Length of $queue |
|
29 | - $pos = 0; // Number of cloned items past the first level |
|
30 | - $refsCounter = 0; // Hard references counter |
|
31 | - $queue = array(array($var)); // This breadth-first queue is the return value |
|
32 | - $arrayRefs = array(); // Map of queue indexes to stub array objects |
|
33 | - $hardRefs = array(); // Map of original zval hashes to stub objects |
|
34 | - $objRefs = array(); // Map of original object handles to their stub object couterpart |
|
35 | - $resRefs = array(); // Map of original resource handles to their stub object couterpart |
|
36 | - $values = array(); // Map of stub objects' hashes to original values |
|
28 | + $len = 1; // Length of $queue |
|
29 | + $pos = 0; // Number of cloned items past the first level |
|
30 | + $refsCounter = 0; // Hard references counter |
|
31 | + $queue = array(array($var)); // This breadth-first queue is the return value |
|
32 | + $arrayRefs = array(); // Map of queue indexes to stub array objects |
|
33 | + $hardRefs = array(); // Map of original zval hashes to stub objects |
|
34 | + $objRefs = array(); // Map of original object handles to their stub object couterpart |
|
35 | + $resRefs = array(); // Map of original resource handles to their stub object couterpart |
|
36 | + $values = array(); // Map of stub objects' hashes to original values |
|
37 | 37 | $maxItems = $this->maxItems; |
38 | 38 | $maxString = $this->maxString; |
39 | - $cookie = (object) array(); // Unique object used to detect hard references |
|
39 | + $cookie = (object) array(); // Unique object used to detect hard references |
|
40 | 40 | $gid = uniqid(mt_rand(), true); // Unique string used to detect the special $GLOBALS variable |
41 | - $a = null; // Array cast for nested structures |
|
42 | - $stub = null; // Stub capturing the main properties of an original item value |
|
41 | + $a = null; // Array cast for nested structures |
|
42 | + $stub = null; // Stub capturing the main properties of an original item value |
|
43 | 43 | // or null if the original value is used directly |
44 | 44 | $zval = array( // Main properties of the current value |
45 | 45 | 'type' => null, |
@@ -57,8 +57,8 @@ discard block |
||
57 | 57 | $hashOffset = self::$hashOffset; |
58 | 58 | |
59 | 59 | for ($i = 0; $i < $len; ++$i) { |
60 | - $indexed = true; // Whether the currently iterated array is numerically indexed or not |
|
61 | - $j = -1; // Position in the currently iterated array |
|
60 | + $indexed = true; // Whether the currently iterated array is numerically indexed or not |
|
61 | + $j = -1; // Position in the currently iterated array |
|
62 | 62 | $fromObjCast = array_keys($queue[$i]); |
63 | 63 | $fromObjCast = array_keys(array_flip($fromObjCast)) !== $fromObjCast; |
64 | 64 | $refs = $vals = $fromObjCast ? array_values($queue[$i]) : $queue[$i]; |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | $zval['type'] = gettype($v); |
82 | 82 | } |
83 | 83 | if ($zval['zval_isref']) { |
84 | - $vals[$k] = &$stub; // Break hard references to make $queue completely |
|
85 | - unset($stub); // independent from the original structure |
|
84 | + $vals[$k] = &$stub; // Break hard references to make $queue completely |
|
85 | + unset($stub); // independent from the original structure |
|
86 | 86 | if (isset($hardRefs[$zval['zval_hash']])) { |
87 | 87 | $vals[$k] = $useExt ? ($v = $hardRefs[$zval['zval_hash']]) : ($refs[$k] = $v); |
88 | 88 | if ($v->value instanceof Stub && (Stub::TYPE_OBJECT === $v->value->type || Stub::TYPE_RESOURCE === $v->value->type)) { |
@@ -193,7 +193,7 @@ |
||
193 | 193 | */ |
194 | 194 | public function cloneVar($var, $filter = 0) |
195 | 195 | { |
196 | - $this->prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context) { |
|
196 | + $this->prevErrorHandler = set_error_handler(function($type, $msg, $file, $line, $context) { |
|
197 | 197 | if (E_RECOVERABLE_ERROR === $type || E_USER_ERROR === $type) { |
198 | 198 | // Cloner never dies |
199 | 199 | throw new \ErrorException($msg, 0, $type, $file, $line); |
@@ -17,6 +17,6 @@ |
||
17 | 17 | */ |
18 | 18 | |
19 | 19 | namespace Detection; |
20 | -require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'Mobile_Detect.php'; |
|
20 | +require_once dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'Mobile_Detect.php'; |
|
21 | 21 | |
22 | 22 | class MobileDetect extends \Mobile_Detect {} |