@@ -54,8 +54,7 @@ discard block |
||
| 54 | 54 | * Class Stack |
| 55 | 55 | * @package Platine\Collection\Stack |
| 56 | 56 | */ |
| 57 | -class Stack implements Countable |
|
| 58 | -{ |
|
| 57 | +class Stack implements Countable { |
|
| 59 | 58 | /** |
| 60 | 59 | * |
| 61 | 60 | * @var string |
@@ -72,8 +71,7 @@ discard block |
||
| 72 | 71 | * Create new instance |
| 73 | 72 | * @param string $type |
| 74 | 73 | */ |
| 75 | - public function __construct(string $type) |
|
| 76 | - { |
|
| 74 | + public function __construct(string $type) { |
|
| 77 | 75 | $this->data = []; |
| 78 | 76 | $this->type = $type; |
| 79 | 77 | } |
@@ -107,8 +105,7 @@ discard block |
||
| 107 | 105 | /** |
| 108 | 106 | * @return mixed |
| 109 | 107 | */ |
| 110 | - public function peek() |
|
| 111 | - { |
|
| 108 | + public function peek() { |
|
| 112 | 109 | if ($this->isEmpty()) { |
| 113 | 110 | throw new InvalidOperationException('The collection is empty'); |
| 114 | 111 | } |
@@ -120,8 +117,7 @@ discard block |
||
| 120 | 117 | * |
| 121 | 118 | * @return mixed |
| 122 | 119 | */ |
| 123 | - public function pop() |
|
| 124 | - { |
|
| 120 | + public function pop() { |
|
| 125 | 121 | return array_pop($this->data); |
| 126 | 122 | } |
| 127 | 123 | |
@@ -131,8 +127,7 @@ discard block |
||
| 131 | 127 | * @param mixed $value |
| 132 | 128 | * @return mixed |
| 133 | 129 | */ |
| 134 | - public function push($value) |
|
| 135 | - { |
|
| 130 | + public function push($value) { |
|
| 136 | 131 | TypeCheck::isValueOf( |
| 137 | 132 | $value, |
| 138 | 133 | $this->type, |
@@ -50,8 +50,7 @@ |
||
| 50 | 50 | * Class IterableInterface |
| 51 | 51 | * @package Platine\Collection |
| 52 | 52 | */ |
| 53 | -interface IterableInterface |
|
| 54 | -{ |
|
| 53 | +interface IterableInterface { |
|
| 55 | 54 | /** |
| 56 | 55 | * Loop on each collection element with the given callback |
| 57 | 56 | * @param callable $callback |
@@ -52,8 +52,7 @@ |
||
| 52 | 52 | * Class TypeCheck |
| 53 | 53 | * @package Platine\Collection |
| 54 | 54 | */ |
| 55 | -class TypeCheck |
|
| 56 | -{ |
|
| 55 | +class TypeCheck { |
|
| 57 | 56 | /** |
| 58 | 57 | * |
| 59 | 58 | * @param mixed $value1 |
@@ -50,8 +50,7 @@ discard block |
||
| 50 | 50 | * Class Pair |
| 51 | 51 | * @package Platine\Collection\Map |
| 52 | 52 | */ |
| 53 | -class Pair |
|
| 54 | -{ |
|
| 53 | +class Pair { |
|
| 55 | 54 | /** |
| 56 | 55 | * |
| 57 | 56 | * @var mixed |
@@ -69,8 +68,7 @@ discard block |
||
| 69 | 68 | * @param mixed $key |
| 70 | 69 | * @param mixed $value |
| 71 | 70 | */ |
| 72 | - public function __construct($key, $value) |
|
| 73 | - { |
|
| 71 | + public function __construct($key, $value) { |
|
| 74 | 72 | $this->key = $key; |
| 75 | 73 | $this->value = $value; |
| 76 | 74 | } |
@@ -79,8 +77,7 @@ discard block |
||
| 79 | 77 | * |
| 80 | 78 | * @return mixed |
| 81 | 79 | */ |
| 82 | - public function getKey() |
|
| 83 | - { |
|
| 80 | + public function getKey() { |
|
| 84 | 81 | return $this->key; |
| 85 | 82 | } |
| 86 | 83 | |
@@ -88,8 +85,7 @@ discard block |
||
| 88 | 85 | * |
| 89 | 86 | * @return mixed |
| 90 | 87 | */ |
| 91 | - public function getValue() |
|
| 92 | - { |
|
| 88 | + public function getValue() { |
|
| 93 | 89 | return $this->value; |
| 94 | 90 | } |
| 95 | 91 | |
@@ -50,8 +50,7 @@ |
||
| 50 | 50 | * Class MapInterface |
| 51 | 51 | * @package Platine\Collection\Map |
| 52 | 52 | */ |
| 53 | -interface MapInterface |
|
| 54 | -{ |
|
| 53 | +interface MapInterface { |
|
| 55 | 54 | /** |
| 56 | 55 | * Add element to the collection |
| 57 | 56 | * @param mixed $key |
@@ -51,8 +51,7 @@ |
||
| 51 | 51 | * @package Platine\Collection |
| 52 | 52 | * @template T |
| 53 | 53 | */ |
| 54 | -interface MergeableInterface |
|
| 55 | -{ |
|
| 54 | +interface MergeableInterface { |
|
| 56 | 55 | /** |
| 57 | 56 | * Merge with the given collection |
| 58 | 57 | * @param BaseCollection<T> $collection |
@@ -51,8 +51,7 @@ |
||
| 51 | 51 | * @package Platine\Collection |
| 52 | 52 | * @template T |
| 53 | 53 | */ |
| 54 | -interface SortableInterface |
|
| 55 | -{ |
|
| 54 | +interface SortableInterface { |
|
| 56 | 55 | /** |
| 57 | 56 | * Sort the collection |
| 58 | 57 | * @param callable $callback |
@@ -50,8 +50,7 @@ |
||
| 50 | 50 | * Class CollectionInterface |
| 51 | 51 | * @package Platine\Collection |
| 52 | 52 | */ |
| 53 | -interface CollectionInterface |
|
| 54 | -{ |
|
| 53 | +interface CollectionInterface { |
|
| 55 | 54 | /** |
| 56 | 55 | * Add element to the collection |
| 57 | 56 | * @param mixed $value |