Completed
Pull Request — master (#4)
by Siwapun
19:18 queued 04:17
created
test/Asset/PlainObjectAsset.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -3,21 +3,21 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
test/AllTest.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -6,27 +6,27 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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)([]));
Please login to merge, or discard this patch.
test/AnyTest.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -7,27 +7,27 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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)([]));
Please login to merge, or discard this patch.
test/CurryNTest.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -7,23 +7,23 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,20 +10,20 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
test/PipeTest.php 2 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -8,30 +8,30 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,10 +25,10 @@
 block discarded – undo
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
     );
Please login to merge, or discard this patch.
src/relation.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,10 +8,10 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
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();
Please login to merge, or discard this patch.
test/ConstructTest.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -8,18 +8,18 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/function.php 2 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@  discard block
 block discarded – undo
8 8
  */
9 9
 function add()
10 10
 {
11
-  $add = function (int $a, int $b) {
11
+    $add = function (int $a, int $b) {
12 12
     return $a + $b;
13
-  };
14
-  $arguments = func_get_args();
15
-  $curried = curryN($add, 2);
16
-  return call_user_func_array($curried, $arguments);
13
+    };
14
+    $arguments = func_get_args();
15
+    $curried = curryN($add, 2);
16
+    return call_user_func_array($curried, $arguments);
17 17
 }
18 18
 
19 19
 /**
@@ -22,14 +22,14 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function always()
24 24
 {
25
-  $always = function ($data) {
25
+    $always = function ($data) {
26 26
     return function () use ($data) {
27
-      return $data;
27
+        return $data;
28
+    };
28 29
     };
29
-  };
30
-  $arguments = func_get_args();
31
-  $curried = curryN($always, 1);
32
-  return call_user_func_array($curried, $arguments);
30
+    $arguments = func_get_args();
31
+    $curried = curryN($always, 1);
32
+    return call_user_func_array($curried, $arguments);
33 33
 }
34 34
 
35 35
 /**
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
  */
39 39
 function compose()
40 40
 {
41
-  $arguments = array_reverse(func_get_args());
42
-  return call_user_func_array('Aerophant\Ramda\pipe', $arguments);
41
+    $arguments = array_reverse(func_get_args());
42
+    return call_user_func_array('Aerophant\Ramda\pipe', $arguments);
43 43
 }
44 44
 
45 45
 /**
@@ -48,37 +48,37 @@  discard block
 block discarded – undo
48 48
  */
49 49
 function construct()
50 50
 {
51
-  $construct = function ($class) {
51
+    $construct = function ($class) {
52 52
     return function () use ($class) {
53
-      return new $class();
53
+        return new $class();
54
+    };
54 55
     };
55
-  };
56
-  $arguments = func_get_args();
57
-  $curried = curryN($construct, 1);
58
-  return call_user_func_array($curried, $arguments);
56
+    $arguments = func_get_args();
57
+    $curried = curryN($construct, 1);
58
+    return call_user_func_array($curried, $arguments);
59 59
 }
60 60
 
61 61
 function curryN(callable $fn, int $numberOfArguments)
62 62
 {
63
-  return function () use ($fn, $numberOfArguments) {
63
+    return function () use ($fn, $numberOfArguments) {
64 64
     $arguments = func_get_args();
65 65
     $length = count($arguments);
66 66
     if ($length > $numberOfArguments) {
67
-      throw new \InvalidArgumentException(
67
+        throw new \InvalidArgumentException(
68 68
         "Number of passed($length) parameters is greater than expected($numberOfArguments)"
69
-      );
69
+        );
70 70
     }
71 71
     // NO CURRY
72 72
     if ($length == $numberOfArguments) {
73
-      return call_user_func_array($fn, $arguments);
73
+        return call_user_func_array($fn, $arguments);
74 74
     }
75 75
     // AUTO CURRY
76 76
     $curriedFn = function () use ($fn, $arguments) {
77
-      $curriedArguments = func_get_args();
78
-      return call_user_func_array($fn, array_merge($arguments, $curriedArguments));
77
+        $curriedArguments = func_get_args();
78
+        return call_user_func_array($fn, array_merge($arguments, $curriedArguments));
79 79
     };
80 80
     return curryN($curriedFn, $numberOfArguments - $length);
81
-  };
81
+    };
82 82
 }
83 83
 
84 84
 /**
@@ -87,17 +87,17 @@  discard block
 block discarded – undo
87 87
  */
88 88
 function pipe()
89 89
 {
90
-  $arguments = func_get_args();
91
-  $length = count($arguments);
92
-  if ($length === 0) {
90
+    $arguments = func_get_args();
91
+    $length = count($arguments);
92
+    if ($length === 0) {
93 93
     throw new \Exception("pipe requires at least one argument");
94
-  }
95
-  return function () use ($arguments) {
94
+    }
95
+    return function () use ($arguments) {
96 96
     $internalArguments = func_get_args();
97 97
     $initialValue = call_user_func_array($arguments[0], $internalArguments);
98 98
     $accumulator = function ($acc, $it) {
99
-      return call_user_func_array($it, [$acc]);
99
+        return call_user_func_array($it, [$acc]);
100 100
     };
101 101
     return array_reduce(drop(0, $arguments), $accumulator, $initialValue);
102
-  };
102
+    };
103 103
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  */
9 9
 function add()
10 10
 {
11
-  $add = function (int $a, int $b) {
11
+  $add = function(int $a, int $b) {
12 12
     return $a + $b;
13 13
   };
14 14
   $arguments = func_get_args();
@@ -22,8 +22,8 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function always()
24 24
 {
25
-  $always = function ($data) {
26
-    return function () use ($data) {
25
+  $always = function($data) {
26
+    return function() use ($data) {
27 27
       return $data;
28 28
     };
29 29
   };
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
  */
49 49
 function construct()
50 50
 {
51
-  $construct = function ($class) {
52
-    return function () use ($class) {
51
+  $construct = function($class) {
52
+    return function() use ($class) {
53 53
       return new $class();
54 54
     };
55 55
   };
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
 function curryN(callable $fn, int $numberOfArguments)
62 62
 {
63
-  return function () use ($fn, $numberOfArguments) {
63
+  return function() use ($fn, $numberOfArguments) {
64 64
     $arguments = func_get_args();
65 65
     $length = count($arguments);
66 66
     if ($length > $numberOfArguments) {
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
       return call_user_func_array($fn, $arguments);
74 74
     }
75 75
     // AUTO CURRY
76
-    $curriedFn = function () use ($fn, $arguments) {
76
+    $curriedFn = function() use ($fn, $arguments) {
77 77
       $curriedArguments = func_get_args();
78 78
       return call_user_func_array($fn, array_merge($arguments, $curriedArguments));
79 79
     };
@@ -92,10 +92,10 @@  discard block
 block discarded – undo
92 92
   if ($length === 0) {
93 93
     throw new \Exception("pipe requires at least one argument");
94 94
   }
95
-  return function () use ($arguments) {
95
+  return function() use ($arguments) {
96 96
     $internalArguments = func_get_args();
97 97
     $initialValue = call_user_func_array($arguments[0], $internalArguments);
98
-    $accumulator = function ($acc, $it) {
98
+    $accumulator = function($acc, $it) {
99 99
       return call_user_func_array($it, [$acc]);
100 100
     };
101 101
     return array_reduce(drop(0, $arguments), $accumulator, $initialValue);
Please login to merge, or discard this patch.
test/AppendTest.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,14 +6,14 @@
 block discarded – undo
6 6
 
7 7
 class AppendTest extends TestCase
8 8
 {
9
-  public function testAppend() {
9
+    public function testAppend() {
10 10
     $result = append(3)([1, 2]);
11 11
     $this->assertEquals([1, 2, 3], $result);
12
-  }
12
+    }
13 13
 
14
-  public function testAppendWithoutAutoCurry() {
14
+    public function testAppendWithoutAutoCurry() {
15 15
     $result = append(3, [1, 2]);
16 16
     $this->assertEquals([1, 2, 3], $result);
17
-  }
17
+    }
18 18
 
19 19
 }
Please login to merge, or discard this patch.