@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | * |
| 34 | 34 | * @param array $items |
| 35 | 35 | */ |
| 36 | - public function __construct(array $items = []) |
|
| 36 | + public function __construct(array $items = [ ]) |
|
| 37 | 37 | { |
| 38 | 38 | $this->items = $items; |
| 39 | 39 | $this->rewind(); |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | public function set($key, $value) |
| 59 | 59 | { |
| 60 | - $this->items[$key] = $value; |
|
| 60 | + $this->items[ $key ] = $value; |
|
| 61 | 61 | |
| 62 | 62 | return $this; |
| 63 | 63 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | public function get($key, $default = null) |
| 74 | 74 | { |
| 75 | 75 | if ($this->containsKey($key)) { |
| 76 | - return $this->items[$key]; |
|
| 76 | + return $this->items[ $key ]; |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | return $default; |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | */ |
| 146 | 146 | public function containsKey($key) |
| 147 | 147 | { |
| 148 | - return isset($this->items[$key]) || array_key_exists($key, $this->items); |
|
| 148 | + return isset($this->items[ $key ]) || array_key_exists($key, $this->items); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | /** |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | */ |
| 177 | 177 | public function add($item) |
| 178 | 178 | { |
| 179 | - $this->items[] = $item; |
|
| 179 | + $this->items[ ] = $item; |
|
| 180 | 180 | |
| 181 | 181 | return $this; |
| 182 | 182 | } |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | public function clear() |
| 190 | 190 | { |
| 191 | - $this->items = []; |
|
| 191 | + $this->items = [ ]; |
|
| 192 | 192 | |
| 193 | 193 | return $this; |
| 194 | 194 | } |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | */ |
| 203 | 203 | public function remove($key) |
| 204 | 204 | { |
| 205 | - unset($this->items[$key]); |
|
| 205 | + unset($this->items[ $key ]); |
|
| 206 | 206 | |
| 207 | 207 | return $this; |
| 208 | 208 | } |
@@ -219,8 +219,8 @@ discard block |
||
| 219 | 219 | if (!$this->containsKey($key)) { |
| 220 | 220 | return null; |
| 221 | 221 | } |
| 222 | - $removed = $this->items[$key]; |
|
| 223 | - unset($this->items[$key]); |
|
| 222 | + $removed = $this->items[ $key ]; |
|
| 223 | + unset($this->items[ $key ]); |
|
| 224 | 224 | |
| 225 | 225 | return $removed; |
| 226 | 226 | } |
@@ -719,8 +719,8 @@ discard block |
||
| 719 | 719 | $collection = Factory::create($items); |
| 720 | 720 | |
| 721 | 721 | return $this->map( |
| 722 | - function ($value, $key, $index) use ($collection) { |
|
| 723 | - return [$value, $collection->indexOf($index)]; |
|
| 722 | + function($value, $key, $index) use ($collection) { |
|
| 723 | + return [ $value, $collection->indexOf($index) ]; |
|
| 724 | 724 | } |
| 725 | 725 | ); |
| 726 | 726 | } |
@@ -831,7 +831,7 @@ discard block |
||
| 831 | 831 | } |
| 832 | 832 | |
| 833 | 833 | return $this->prune( |
| 834 | - function ($value, $key, $index) use ($offset, $length) { |
|
| 834 | + function($value, $key, $index) use ($offset, $length) { |
|
| 835 | 835 | return !(($index >= $offset) && ($index < $offset + $length)); |
| 836 | 836 | } |
| 837 | 837 | ); |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | * |
| 24 | 24 | * @return Collection |
| 25 | 25 | */ |
| 26 | - public static function create($items = [], $className = 'Novactive\Collection\Collection') |
|
| 26 | + public static function create($items = [ ], $className = 'Novactive\Collection\Collection') |
|
| 27 | 27 | { |
| 28 | 28 | $options = null; |
| 29 | 29 | if (getenv('DEBUG_COLLECTION_CLASS') && getenv('DEBUG_COLLECTION_CLASS') != '') { |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | /** |
| 24 | 24 | * @var array |
| 25 | 25 | */ |
| 26 | - public static $modules = []; |
|
| 26 | + public static $modules = [ ]; |
|
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * Load. |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | include __DIR__.'/../bootstrap.php'; |
| 11 | 11 | $credentials = include __DIR__.'/imgur.credentials.php'; |
| 12 | 12 | |
| 13 | -$version = (string)$_SERVER['argv'][1]; |
|
| 13 | +$version = (string)$_SERVER[ 'argv' ][ 1 ]; |
|
| 14 | 14 | |
| 15 | 15 | $fileName = __DIR__."/../../{$version}_graph.png"; |
| 16 | 16 | if (!file_exists($fileName)) { |
@@ -19,18 +19,18 @@ discard block |
||
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | $file = file_get_contents($fileName); |
| 22 | -$headers = ["Authorization: Client-ID {$credentials['client_id']}"]; |
|
| 22 | +$headers = [ "Authorization: Client-ID {$credentials[ 'client_id' ]}" ]; |
|
| 23 | 23 | $url = 'https://api.imgur.com/3/image.json'; |
| 24 | 24 | |
| 25 | 25 | $where = getenv('TRAVIS_JOB_NUMBER') ? 'Travis #'.getenv('TRAVIS_JOB_NUMBER') : gethostname().' - '.date('Y-m-d H:i:s'). |
| 26 | 26 | ' - '.date_default_timezone_get(); |
| 27 | 27 | $pvars = [ |
| 28 | - 'album' => $credentials['ablum_id'], |
|
| 28 | + 'album' => $credentials[ 'ablum_id' ], |
|
| 29 | 29 | 'name' => "Build {$version}", |
| 30 | 30 | 'description' => "Build {$version} on ".$where, |
| 31 | 31 | 'image' => base64_encode($file), |
| 32 | 32 | ]; |
| 33 | -$curl = curl_init(); |
|
| 33 | +$curl = curl_init(); |
|
| 34 | 34 | curl_setopt_array( |
| 35 | 35 | $curl, |
| 36 | 36 | [ |
@@ -14,10 +14,10 @@ discard block |
||
| 14 | 14 | include __DIR__.'/../bootstrap.php'; |
| 15 | 15 | ini_set('memory_limit', '8500M'); |
| 16 | 16 | |
| 17 | -$method = (string)$_SERVER['argv'][1]; |
|
| 18 | -$collectionType = (int)$_SERVER['argv'][2]; |
|
| 19 | -$iterations = (int)$_SERVER['argv'][3]; |
|
| 20 | -$jsonMode = (bool)$_SERVER['argv'][4]; |
|
| 17 | +$method = (string)$_SERVER[ 'argv' ][ 1 ]; |
|
| 18 | +$collectionType = (int)$_SERVER[ 'argv' ][ 2 ]; |
|
| 19 | +$iterations = (int)$_SERVER[ 'argv' ][ 3 ]; |
|
| 20 | +$jsonMode = (bool)$_SERVER[ 'argv' ][ 4 ]; |
|
| 21 | 21 | |
| 22 | 22 | $data = range(0, $iterations - 1); |
| 23 | 23 | $data2 = range(0, $iterations - 1); |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | shuffle($data2); |
| 26 | 26 | |
| 27 | 27 | // if we want with text instead of integer but it does not change anything |
| 28 | -$textitize = function ($value) { |
|
| 28 | +$textitize = function($value) { |
|
| 29 | 29 | return md5($value); |
| 30 | 30 | }; |
| 31 | 31 | //$data = array_map($textitize,$data); |
@@ -49,19 +49,19 @@ discard block |
||
| 49 | 49 | $start = microtime(true); |
| 50 | 50 | |
| 51 | 51 | if ($method == 'filter') { |
| 52 | - $fn = function ($item) { |
|
| 52 | + $fn = function($item) { |
|
| 53 | 53 | return $item % 2; |
| 54 | 54 | }; |
| 55 | 55 | $collection->filter($fn); |
| 56 | 56 | } |
| 57 | 57 | if ($method == 'map') { |
| 58 | - $fn = function ($item) { |
|
| 58 | + $fn = function($item) { |
|
| 59 | 59 | return $item.'nova'; |
| 60 | 60 | }; |
| 61 | 61 | $collection->map($fn); |
| 62 | 62 | } |
| 63 | 63 | if ($method == 'each') { |
| 64 | - $fn = function ($item) { |
|
| 64 | + $fn = function($item) { |
|
| 65 | 65 | $item .= 'nova'; |
| 66 | 66 | }; |
| 67 | 67 | $collection->each($fn); |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | if ($method == 'reduce') { |
| 74 | - $fn = function ($item) { |
|
| 74 | + $fn = function($item) { |
|
| 75 | 75 | $item .= 'nova'; |
| 76 | 76 | |
| 77 | 77 | return $item; |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | $collection->union($data2); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | -if (in_array($method, ['flip', 'values', 'keys', 'unique', 'reverse', 'shift', 'pop'])) { |
|
| 93 | +if (in_array($method, [ 'flip', 'values', 'keys', 'unique', 'reverse', 'shift', 'pop' ])) { |
|
| 94 | 94 | $collection->$method(); |
| 95 | 95 | } |
| 96 | 96 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | ); |
| 80 | 80 | } |
| 81 | 81 | $values = Factory::getArrayForItems($values); |
| 82 | - $collection = Factory::create([], static::class); |
|
| 82 | + $collection = Factory::create([ ], static::class); |
|
| 83 | 83 | $this->rewind(); |
| 84 | 84 | foreach ($values as $value) { |
| 85 | 85 | $collection->set($this->current(), $value); |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | public function flip() |
| 110 | 110 | { |
| 111 | - $collection = Factory::create([], static::class); |
|
| 111 | + $collection = Factory::create([ ], static::class); |
|
| 112 | 112 | foreach ($this->items as $key => $value) { |
| 113 | 113 | $collection->set($value, $key); |
| 114 | 114 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | public function values() |
| 123 | 123 | { |
| 124 | - $collection = Factory::create([], static::class); |
|
| 124 | + $collection = Factory::create([ ], static::class); |
|
| 125 | 125 | foreach ($this->items as $value) { |
| 126 | 126 | $collection->add($value); |
| 127 | 127 | } |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | public function keys() |
| 136 | 136 | { |
| 137 | - $collection = Factory::create([], static::class); |
|
| 137 | + $collection = Factory::create([ ], static::class); |
|
| 138 | 138 | foreach ($this->items as $key => $value) { |
| 139 | 139 | $collection->add($key); |
| 140 | 140 | } |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | public function unique() |
| 149 | 149 | { |
| 150 | - $collection = Factory::create([], static::class); |
|
| 150 | + $collection = Factory::create([ ], static::class); |
|
| 151 | 151 | foreach ($this->items as $value) { |
| 152 | 152 | // testing with in_array to not be dependant as in_array is faster and this collection would use foreach |
| 153 | 153 | // we want to test unique here, not in_array |
@@ -212,13 +212,13 @@ discard block |
||
| 212 | 212 | */ |
| 213 | 213 | public function reverse() |
| 214 | 214 | { |
| 215 | - $collection = Factory::create([], static::class); |
|
| 215 | + $collection = Factory::create([ ], static::class); |
|
| 216 | 216 | $count = $this->count(); |
| 217 | 217 | $keys = $this->keys(); |
| 218 | 218 | $values = $this->values(); |
| 219 | 219 | |
| 220 | 220 | for ($i = $count - 1; $i >= 0; $i--) { |
| 221 | - $collection->set($keys[$i], $values[$i]); |
|
| 221 | + $collection->set($keys[ $i ], $values[ $i ]); |
|
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | return $collection; |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | return $this->filter( |
| 278 | - function ($value, $key, $index) use ($offset, $length) { |
|
| 278 | + function($value, $key, $index) use ($offset, $length) { |
|
| 279 | 279 | return ($index >= $offset) && ($index < $offset + $length); |
| 280 | 280 | } |
| 281 | 281 | ); |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | $itemsCollection = Factory::create($items); |
| 290 | 290 | |
| 291 | 291 | return $this->filter( |
| 292 | - function ($value, $key, $index) use ($itemsCollection) { |
|
| 292 | + function($value, $key, $index) use ($itemsCollection) { |
|
| 293 | 293 | return !$itemsCollection->contains($value); |
| 294 | 294 | } |
| 295 | 295 | ); |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | $itemsCollection = Factory::create($items); |
| 304 | 304 | |
| 305 | 305 | return $this->filter( |
| 306 | - function ($value, $key, $index) use ($itemsCollection) { |
|
| 306 | + function($value, $key, $index) use ($itemsCollection) { |
|
| 307 | 307 | return !$itemsCollection->containsKey($key); |
| 308 | 308 | } |
| 309 | 309 | ); |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | $itemsCollection = Factory::create($items); |
| 318 | 318 | |
| 319 | 319 | return $this->filter( |
| 320 | - function ($value, $key, $index) use ($itemsCollection) { |
|
| 320 | + function($value, $key, $index) use ($itemsCollection) { |
|
| 321 | 321 | return $itemsCollection->contains($value); |
| 322 | 322 | } |
| 323 | 323 | ); |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | $itemsCollection = Factory::create($items); |
| 332 | 332 | |
| 333 | 333 | return $this->filter( |
| 334 | - function ($value, $key, $index) use ($itemsCollection) { |
|
| 334 | + function($value, $key, $index) use ($itemsCollection) { |
|
| 335 | 335 | return $itemsCollection->containsKey($key); |
| 336 | 336 | } |
| 337 | 337 | ); |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | include __DIR__.'/../bootstrap.php'; |
| 17 | 17 | |
| 18 | -$version = (string)$_SERVER['argv'][1]; |
|
| 18 | +$version = (string)$_SERVER[ 'argv' ][ 1 ]; |
|
| 19 | 19 | $fileName = __DIR__."/results{$version}.data"; |
| 20 | 20 | if (!file_exists($fileName)) { |
| 21 | 21 | echo 'Data file does not exist.'; |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | $graphWidth = 800; |
| 31 | 31 | $graphHeight = 400; |
| 32 | 32 | |
| 33 | -$methods = $graphsLimit = []; |
|
| 33 | +$methods = $graphsLimit = [ ]; |
|
| 34 | 34 | foreach ($configs as $config) { |
| 35 | 35 | if (empty(trim($config))) { |
| 36 | 36 | continue; |
@@ -55,11 +55,11 @@ discard block |
||
| 55 | 55 | JpGraph::module('mgraph'); |
| 56 | 56 | |
| 57 | 57 | $secondGraphSteps = Factory::create(); |
| 58 | -$classes = Factory::create([Collection::class, ArrayMethodCollection::class, ForeachMethodCollection::class]); |
|
| 58 | +$classes = Factory::create([ Collection::class, ArrayMethodCollection::class, ForeachMethodCollection::class ]); |
|
| 59 | 59 | |
| 60 | 60 | $dataCollection = Factory::create($data); |
| 61 | 61 | |
| 62 | -$createGraph = function ($title, $axis) use ($graphWidth, $graphHeight) { |
|
| 62 | +$createGraph = function($title, $axis) use ($graphWidth, $graphHeight) { |
|
| 63 | 63 | $graph = new Graph($graphWidth, $graphHeight); |
| 64 | 64 | $graph->SetScale('intlin'); |
| 65 | 65 | $graph->title->Set($title); |
@@ -87,12 +87,12 @@ discard block |
||
| 87 | 87 | foreach ($classes as $class) { |
| 88 | 88 | /** @var Collection $plotsValues */ |
| 89 | 89 | $plotsValues = $dataCollection->dump()->filter( |
| 90 | - function ($value) use ($method, $class, $axisList) { |
|
| 90 | + function($value) use ($method, $class, $axisList) { |
|
| 91 | 91 | return $value->method == $method && $value->type == $class && |
| 92 | 92 | in_array($value->iterations, $axisList); |
| 93 | 93 | } |
| 94 | 94 | )->dump()->map( |
| 95 | - function ($value) { |
|
| 95 | + function($value) { |
|
| 96 | 96 | return (float)$value->time; |
| 97 | 97 | } |
| 98 | 98 | )->dump()->combineKeys($axisList); |
@@ -38,5 +38,5 @@ |
||
| 38 | 38 | } |
| 39 | 39 | $inPlace = $returnType == 'this'; |
| 40 | 40 | echo '|'.$signature.'|'.$doc->getSummary().'|'.($inPlace ? ':white_check_mark:' : ':negative_squared_cross_mark:'). |
| 41 | - "|\n"; |
|
| 41 | + "|\n"; |
|
| 42 | 42 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | } |
| 23 | 23 | $paramsColl = new Collection($method->getParameters()); |
| 24 | 24 | $params = $paramsColl->map( |
| 25 | - function (ReflectionParameter $parameter) { |
|
| 25 | + function(ReflectionParameter $parameter) { |
|
| 26 | 26 | return $parameter->getType().' $'.$parameter->name; |
| 27 | 27 | } |
| 28 | 28 | )->implode(', '); |
@@ -31,8 +31,8 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | $returnType = 'void'; |
| 33 | 33 | /* @var phpDocumentor\Reflection\DocBlock\Tags\Return_ $returnType */ |
| 34 | - if (isset($doc->getTagsByName('return')[0])) { |
|
| 35 | - $type = $doc->getTagsByName('return')[0]->getType(); |
|
| 34 | + if (isset($doc->getTagsByName('return')[ 0 ])) { |
|
| 35 | + $type = $doc->getTagsByName('return')[ 0 ]->getType(); |
|
| 36 | 36 | $classNameParts = explode('\\', get_class($type)); |
| 37 | 37 | $returnType = trim(strtolower(array_pop($classNameParts)), '_'); |
| 38 | 38 | } |
@@ -20,10 +20,10 @@ |
||
| 20 | 20 | { |
| 21 | 21 | public function testCollectionToArrayConvertsItemsToArray() |
| 22 | 22 | { |
| 23 | - $coll = Factory::create($this->fixtures['names']); |
|
| 23 | + $coll = Factory::create($this->fixtures[ 'names' ]); |
|
| 24 | 24 | $this->assertInstanceOf(Collection::class, $coll); |
| 25 | 25 | $this->assertEquals( |
| 26 | - ['Chelsea', 'Adella', 'Monte', 'Maye', 'Lottie', 'Don', 'Dayton', 'Kirk', 'Troy', 'Nakia'], |
|
| 26 | + [ 'Chelsea', 'Adella', 'Monte', 'Maye', 'Lottie', 'Don', 'Dayton', 'Kirk', 'Troy', 'Nakia' ], |
|
| 27 | 27 | $coll->toArray() |
| 28 | 28 | ); |
| 29 | 29 | } |