@@ -3,21 +3,21 @@ |
||
| 3 | 3 | |
| 4 | 4 | class PlainObjectAsset |
| 5 | 5 | { |
| 6 | - private $data; |
|
| 6 | + private $data; |
|
| 7 | 7 | |
| 8 | - /** |
|
| 9 | - * @return mixed |
|
| 10 | - */ |
|
| 11 | - public function getData() |
|
| 12 | - { |
|
| 8 | + /** |
|
| 9 | + * @return mixed |
|
| 10 | + */ |
|
| 11 | + public function getData() |
|
| 12 | + { |
|
| 13 | 13 | return $this->data; |
| 14 | - } |
|
| 14 | + } |
|
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * @param mixed $data |
|
| 18 | - */ |
|
| 19 | - public function setData($data): void |
|
| 20 | - { |
|
| 16 | + /** |
|
| 17 | + * @param mixed $data |
|
| 18 | + */ |
|
| 19 | + public function setData($data): void |
|
| 20 | + { |
|
| 21 | 21 | $this->data = $data; |
| 22 | - } |
|
| 22 | + } |
|
| 23 | 23 | } |
@@ -6,27 +6,27 @@ |
||
| 6 | 6 | |
| 7 | 7 | class AllTest extends TestCase |
| 8 | 8 | { |
| 9 | - public function testAllAndExpectTrue() |
|
| 10 | - { |
|
| 9 | + public function testAllAndExpectTrue() |
|
| 10 | + { |
|
| 11 | 11 | $lessThan10 = function ($it) { |
| 12 | - return $it < 10; |
|
| 12 | + return $it < 10; |
|
| 13 | 13 | }; |
| 14 | 14 | $this->assertTrue(all($lessThan10)([1, 2, 3, 4])); |
| 15 | - } |
|
| 15 | + } |
|
| 16 | 16 | |
| 17 | - public function testAllAndExpectFalse() |
|
| 18 | - { |
|
| 17 | + public function testAllAndExpectFalse() |
|
| 18 | + { |
|
| 19 | 19 | $lessThan10 = function ($it) { |
| 20 | - return $it < 10; |
|
| 20 | + return $it < 10; |
|
| 21 | 21 | }; |
| 22 | 22 | $this->assertFalse(all($lessThan10)([1, 2, 3, 4, 20])); |
| 23 | - } |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - public function testAllWithEmptyArray() |
|
| 26 | - { |
|
| 25 | + public function testAllWithEmptyArray() |
|
| 26 | + { |
|
| 27 | 27 | $predicate = function ($it) { |
| 28 | - return true; |
|
| 28 | + return true; |
|
| 29 | 29 | }; |
| 30 | 30 | $this->assertFalse(all($predicate)([])); |
| 31 | - } |
|
| 31 | + } |
|
| 32 | 32 | } |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | { |
| 9 | 9 | public function testAllAndExpectTrue() |
| 10 | 10 | { |
| 11 | - $lessThan10 = function ($it) { |
|
| 11 | + $lessThan10 = function($it) { |
|
| 12 | 12 | return $it < 10; |
| 13 | 13 | }; |
| 14 | 14 | $this->assertTrue(all($lessThan10)([1, 2, 3, 4])); |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | public function testAllAndExpectFalse() |
| 18 | 18 | { |
| 19 | - $lessThan10 = function ($it) { |
|
| 19 | + $lessThan10 = function($it) { |
|
| 20 | 20 | return $it < 10; |
| 21 | 21 | }; |
| 22 | 22 | $this->assertFalse(all($lessThan10)([1, 2, 3, 4, 20])); |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | public function testAllWithEmptyArray() |
| 26 | 26 | { |
| 27 | - $predicate = function ($it) { |
|
| 27 | + $predicate = function($it) { |
|
| 28 | 28 | return true; |
| 29 | 29 | }; |
| 30 | 30 | $this->assertFalse(all($predicate)([])); |
@@ -7,27 +7,27 @@ |
||
| 7 | 7 | class AnyTest extends TestCase |
| 8 | 8 | { |
| 9 | 9 | |
| 10 | - public function testAnyAndExpectTrue() |
|
| 11 | - { |
|
| 10 | + public function testAnyAndExpectTrue() |
|
| 11 | + { |
|
| 12 | 12 | $lessThan2 = function ($it) { |
| 13 | - return $it < 2; |
|
| 13 | + return $it < 2; |
|
| 14 | 14 | }; |
| 15 | 15 | $this->assertTrue(any($lessThan2)([1, 2, 3, 4])); |
| 16 | - } |
|
| 16 | + } |
|
| 17 | 17 | |
| 18 | - public function testAnyAndExpectFalse() |
|
| 19 | - { |
|
| 18 | + public function testAnyAndExpectFalse() |
|
| 19 | + { |
|
| 20 | 20 | $lessThan2 = function ($it) { |
| 21 | - return $it < 2; |
|
| 21 | + return $it < 2; |
|
| 22 | 22 | }; |
| 23 | 23 | $this->assertFalse(any($lessThan2)([3, 4, 5, 6])); |
| 24 | - } |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - public function testAnyWithEmptyArray() |
|
| 27 | - { |
|
| 26 | + public function testAnyWithEmptyArray() |
|
| 27 | + { |
|
| 28 | 28 | $predicate = function ($it) { |
| 29 | - return true; |
|
| 29 | + return true; |
|
| 30 | 30 | }; |
| 31 | 31 | $this->assertFalse(any($predicate)([])); |
| 32 | - } |
|
| 32 | + } |
|
| 33 | 33 | } |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | public function testAnyAndExpectTrue() |
| 11 | 11 | { |
| 12 | - $lessThan2 = function ($it) { |
|
| 12 | + $lessThan2 = function($it) { |
|
| 13 | 13 | return $it < 2; |
| 14 | 14 | }; |
| 15 | 15 | $this->assertTrue(any($lessThan2)([1, 2, 3, 4])); |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | public function testAnyAndExpectFalse() |
| 19 | 19 | { |
| 20 | - $lessThan2 = function ($it) { |
|
| 20 | + $lessThan2 = function($it) { |
|
| 21 | 21 | return $it < 2; |
| 22 | 22 | }; |
| 23 | 23 | $this->assertFalse(any($lessThan2)([3, 4, 5, 6])); |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | public function testAnyWithEmptyArray() |
| 27 | 27 | { |
| 28 | - $predicate = function ($it) { |
|
| 28 | + $predicate = function($it) { |
|
| 29 | 29 | return true; |
| 30 | 30 | }; |
| 31 | 31 | $this->assertFalse(any($predicate)([])); |
@@ -7,23 +7,23 @@ |
||
| 7 | 7 | class CurryNTest extends TestCase |
| 8 | 8 | { |
| 9 | 9 | |
| 10 | - public function testCurryNWithInvokeFunctionDirectly() |
|
| 11 | - { |
|
| 10 | + public function testCurryNWithInvokeFunctionDirectly() |
|
| 11 | + { |
|
| 12 | 12 | $curriedReduce = curryN('array_reduce', 3); |
| 13 | 13 | $add = function ($a, $b) { |
| 14 | - return $a + $b; |
|
| 14 | + return $a + $b; |
|
| 15 | 15 | }; |
| 16 | 16 | $result = $curriedReduce([4,5,6], $add, 0); |
| 17 | 17 | $this->assertEquals(15, $result); |
| 18 | - } |
|
| 18 | + } |
|
| 19 | 19 | |
| 20 | - public function testCurryNWithAutoCurry() |
|
| 21 | - { |
|
| 20 | + public function testCurryNWithAutoCurry() |
|
| 21 | + { |
|
| 22 | 22 | $curriedReduce = curryN('array_reduce', 3); |
| 23 | 23 | $add = function ($a, $b) { |
| 24 | - return $a + $b; |
|
| 24 | + return $a + $b; |
|
| 25 | 25 | }; |
| 26 | 26 | $result = $curriedReduce([4,5,6])($add)(0); |
| 27 | 27 | $this->assertEquals(15, $result); |
| 28 | - } |
|
| 28 | + } |
|
| 29 | 29 | } |
@@ -10,20 +10,20 @@ |
||
| 10 | 10 | public function testCurryNWithInvokeFunctionDirectly() |
| 11 | 11 | { |
| 12 | 12 | $curriedReduce = curryN('array_reduce', 3); |
| 13 | - $add = function ($a, $b) { |
|
| 13 | + $add = function($a, $b) { |
|
| 14 | 14 | return $a + $b; |
| 15 | 15 | }; |
| 16 | - $result = $curriedReduce([4,5,6], $add, 0); |
|
| 16 | + $result = $curriedReduce([4, 5, 6], $add, 0); |
|
| 17 | 17 | $this->assertEquals(15, $result); |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | public function testCurryNWithAutoCurry() |
| 21 | 21 | { |
| 22 | 22 | $curriedReduce = curryN('array_reduce', 3); |
| 23 | - $add = function ($a, $b) { |
|
| 23 | + $add = function($a, $b) { |
|
| 24 | 24 | return $a + $b; |
| 25 | 25 | }; |
| 26 | - $result = $curriedReduce([4,5,6])($add)(0); |
|
| 26 | + $result = $curriedReduce([4, 5, 6])($add)(0); |
|
| 27 | 27 | $this->assertEquals(15, $result); |
| 28 | 28 | } |
| 29 | 29 | } |
@@ -8,30 +8,30 @@ |
||
| 8 | 8 | class PipeTest extends TestCase |
| 9 | 9 | { |
| 10 | 10 | |
| 11 | - /** |
|
| 12 | - * @throws \Exception |
|
| 13 | - */ |
|
| 14 | - public function testPipeSingleMethod() |
|
| 15 | - { |
|
| 11 | + /** |
|
| 12 | + * @throws \Exception |
|
| 13 | + */ |
|
| 14 | + public function testPipeSingleMethod() |
|
| 15 | + { |
|
| 16 | 16 | $piped = pipe( |
| 17 | - always(10) |
|
| 17 | + always(10) |
|
| 18 | 18 | ); |
| 19 | 19 | $this->assertEquals(10, $piped()); |
| 20 | - } |
|
| 20 | + } |
|
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * @throws \Exception |
|
| 24 | - */ |
|
| 25 | - public function testPipeMultipleMethods() |
|
| 26 | - { |
|
| 22 | + /** |
|
| 23 | + * @throws \Exception |
|
| 24 | + */ |
|
| 25 | + public function testPipeMultipleMethods() |
|
| 26 | + { |
|
| 27 | 27 | $piped = pipe( |
| 28 | - function ($a, $b) { |
|
| 28 | + function ($a, $b) { |
|
| 29 | 29 | return $a + $b; |
| 30 | - }, |
|
| 31 | - function ($i) { |
|
| 30 | + }, |
|
| 31 | + function ($i) { |
|
| 32 | 32 | return $i * 10; |
| 33 | - } |
|
| 33 | + } |
|
| 34 | 34 | ); |
| 35 | 35 | $this->assertEquals(30, $piped(1, 2)); |
| 36 | - } |
|
| 36 | + } |
|
| 37 | 37 | } |
@@ -25,10 +25,10 @@ |
||
| 25 | 25 | public function testPipeMultipleMethods() |
| 26 | 26 | { |
| 27 | 27 | $piped = pipe( |
| 28 | - function ($a, $b) { |
|
| 28 | + function($a, $b) { |
|
| 29 | 29 | return $a + $b; |
| 30 | 30 | }, |
| 31 | - function ($i) { |
|
| 31 | + function($i) { |
|
| 32 | 32 | return $i * 10; |
| 33 | 33 | } |
| 34 | 34 | ); |
@@ -8,10 +8,10 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | function equals() |
| 10 | 10 | { |
| 11 | - $equals = function ($a, $b) { |
|
| 11 | + $equals = function ($a, $b) { |
|
| 12 | 12 | return $a == $b; |
| 13 | - }; |
|
| 14 | - $arguments = func_get_args(); |
|
| 15 | - $curried = curryN($equals, 2); |
|
| 16 | - return call_user_func_array($curried, $arguments); |
|
| 13 | + }; |
|
| 14 | + $arguments = func_get_args(); |
|
| 15 | + $curried = curryN($equals, 2); |
|
| 16 | + return call_user_func_array($curried, $arguments); |
|
| 17 | 17 | } |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | function equals() |
| 10 | 10 | { |
| 11 | - $equals = function ($a, $b) { |
|
| 11 | + $equals = function($a, $b) { |
|
| 12 | 12 | return $a == $b; |
| 13 | 13 | }; |
| 14 | 14 | $arguments = func_get_args(); |
@@ -8,18 +8,18 @@ |
||
| 8 | 8 | class ConstructTest extends TestCase |
| 9 | 9 | { |
| 10 | 10 | |
| 11 | - public function testFactoryMustReturnCorrectObjectType() |
|
| 12 | - { |
|
| 11 | + public function testFactoryMustReturnCorrectObjectType() |
|
| 12 | + { |
|
| 13 | 13 | $construct = construct()(PlainObjectAsset::class); |
| 14 | 14 | $obj = $construct(); |
| 15 | 15 | $this->assertInstanceOf(PlainObjectAsset::class, $obj); |
| 16 | - } |
|
| 16 | + } |
|
| 17 | 17 | |
| 18 | - public function testFactoryMustAlwaysReturnNewObject() |
|
| 19 | - { |
|
| 18 | + public function testFactoryMustAlwaysReturnNewObject() |
|
| 19 | + { |
|
| 20 | 20 | $construct = construct()(PlainObjectAsset::class); |
| 21 | 21 | $obj1 = $construct(); |
| 22 | 22 | $obj2 = $construct(); |
| 23 | 23 | $this->assertNotSame($obj1, $obj2); |
| 24 | - } |
|
| 24 | + } |
|
| 25 | 25 | } |
@@ -7,8 +7,8 @@ |
||
| 7 | 7 | |
| 8 | 8 | class DropFirstTest extends TestCase |
| 9 | 9 | { |
| 10 | - public function testDropFirst() |
|
| 11 | - { |
|
| 10 | + public function testDropFirst() |
|
| 11 | + { |
|
| 12 | 12 | $this->assertEquals([2,3,4], dropFirst()([1,2,3,4])); |
| 13 | - } |
|
| 13 | + } |
|
| 14 | 14 | } |
@@ -9,6 +9,6 @@ |
||
| 9 | 9 | { |
| 10 | 10 | public function testDropFirst() |
| 11 | 11 | { |
| 12 | - $this->assertEquals([2,3,4], dropFirst()([1,2,3,4])); |
|
| 12 | + $this->assertEquals([2, 3, 4], dropFirst()([1, 2, 3, 4])); |
|
| 13 | 13 | } |
| 14 | 14 | } |
@@ -6,12 +6,12 @@ |
||
| 6 | 6 | |
| 7 | 7 | class ConcatTest extends TestCase |
| 8 | 8 | { |
| 9 | - public function testConcat() |
|
| 10 | - { |
|
| 9 | + public function testConcat() |
|
| 10 | + { |
|
| 11 | 11 | $firstArray = [1, 2, 3]; |
| 12 | 12 | $secondArray = [4, 5, 6]; |
| 13 | 13 | $expectedResult = [1, 2, 3, 4, 5, 6]; |
| 14 | 14 | $actualResult = concat($firstArray)($secondArray); |
| 15 | 15 | $this->assertEquals($expectedResult, $actualResult); |
| 16 | - } |
|
| 16 | + } |
|
| 17 | 17 | } |