@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | { |
| 33 | 33 | $countKeys=array(); |
| 34 | 34 | $response=array(); |
| 35 | - $simple = true; |
|
| 35 | + $simple=true; |
|
| 36 | 36 | |
| 37 | 37 | if ((is_object($mixed)&&key_exists('Traversable', class_implements($mixed)))) { |
| 38 | 38 | self::hNALoop($mixed, $simple, $response, $countKeys); |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | $i=0; |
| 48 | 48 | foreach ($mixed as $k=>$val) { |
| 49 | 49 | if (!is_int($val)&&!is_string($val)) { |
| 50 | - $simple = false; |
|
| 50 | + $simple=false; |
|
| 51 | 51 | } |
| 52 | 52 | if (($offset=array_search($val, $response, true))===false) { |
| 53 | 53 | $response[$i]=$val; |
@@ -60,42 +60,40 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | private static function handleArray($array, &$countKeys, &$response, &$simple) |
| 62 | 62 | { |
| 63 | - $i = 0; |
|
| 64 | - $countKeys = array(); |
|
| 65 | - $simple = true; |
|
| 66 | - $callback = function ($carry, $item) use (&$i,&$countKeys ,&$simple) { |
|
| 63 | + $i=0; |
|
| 64 | + $countKeys=array(); |
|
| 65 | + $simple=true; |
|
| 66 | + $callback=function($carry, $item) use (&$i, &$countKeys, &$simple) { |
|
| 67 | 67 | if (!is_array($carry)) { |
| 68 | - $carry = array(); |
|
| 68 | + $carry=array(); |
|
| 69 | 69 | } |
| 70 | 70 | if (!is_int($item)&&!is_string($item)) { |
| 71 | - $simple = false; |
|
| 71 | + $simple=false; |
|
| 72 | 72 | } |
| 73 | - if (false === $k = array_search($item, $carry, true)) { |
|
| 74 | - $carry[$i] = $item; |
|
| 75 | - $countKeys[$i++] = 1; |
|
| 73 | + if (false===$k=array_search($item, $carry, true)) { |
|
| 74 | + $carry[$i]=$item; |
|
| 75 | + $countKeys[$i++]=1; |
|
| 76 | 76 | } else { |
| 77 | 77 | $countKeys[$k]++; |
| 78 | 78 | } |
| 79 | 79 | return $carry; |
| 80 | 80 | }; |
| 81 | - $response = array_reduce($array, $callback); |
|
| 81 | + $response=array_reduce($array, $callback); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | private static function getIterator($simple, $response, $countKeys) |
| 85 | 85 | { |
| 86 | - return $simple? |
|
| 87 | - new AVCIterator(array_combine($response, $countKeys), null): |
|
| 88 | - new AVCIterator($response, $countKeys); |
|
| 86 | + return $simple ? |
|
| 87 | + new AVCIterator(array_combine($response, $countKeys), null) : new AVCIterator($response, $countKeys); |
|
| 89 | 88 | } |
| 90 | 89 | |
| 91 | 90 | private static function getResponse($simple, $response, $countKeys) |
| 92 | 91 | { |
| 93 | - $callback = function ($value, $count) { |
|
| 94 | - return array($value,$count); |
|
| 92 | + $callback=function($value, $count) { |
|
| 93 | + return array($value, $count); |
|
| 95 | 94 | }; |
| 96 | - return $simple? |
|
| 97 | - array_combine($response, $countKeys): |
|
| 98 | - array_map($callback, $response, $countKeys); |
|
| 95 | + return $simple ? |
|
| 96 | + array_combine($response, $countKeys) : array_map($callback, $response, $countKeys); |
|
| 99 | 97 | } |
| 100 | 98 | } |
| 101 | 99 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | if ($this->isSimple()) { |
| 45 | 45 | unset($this->keys[$key]); |
| 46 | 46 | } else { |
| 47 | - unset($this->container[$k=array_search($key, $this->keys, true)],$this->keys[$k]); |
|
| 47 | + unset($this->container[$k=array_search($key, $this->keys, true)], $this->keys[$k]); |
|
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | |
@@ -101,8 +101,8 @@ discard block |
||
| 101 | 101 | if ($this->isSimple()) { |
| 102 | 102 | return $this->keys; |
| 103 | 103 | } else { |
| 104 | - $callback = function ($value, $count) { |
|
| 105 | - return array($value,$count); |
|
| 104 | + $callback=function($value, $count) { |
|
| 105 | + return array($value, $count); |
|
| 106 | 106 | }; |
| 107 | 107 | return array_map($callback, $this->keys, $this->container); |
| 108 | 108 | } |
@@ -77,7 +77,7 @@ |
||
| 77 | 77 | reset($this->keys); |
| 78 | 78 | } else { |
| 79 | 79 | reset($this->keys); |
| 80 | - reset($this->container); |
|
| 80 | + reset($this->container); |
|
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | |