Completed
Pull Request — master (#4)
by Siwapun
21:56 queued 06:35
created
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.
test/DropFirstTest.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
test/ConcatTest.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,12 +6,12 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
test/DivideTest.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,12 +6,12 @@
 block discarded – undo
6 6
 
7 7
 class DivideTest extends TestCase
8 8
 {
9
-  public function testDivide()
10
-  {
9
+    public function testDivide()
10
+    {
11 11
     $firstValue = 50;
12 12
     $secondValue = 10;
13 13
     $expectedResult = 5;
14 14
     $actualResult = divide($firstValue)($secondValue);
15 15
     $this->assertEquals($expectedResult, $actualResult);
16
-  }
16
+    }
17 17
 }
Please login to merge, or discard this patch.
test/MultiplyTest.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,12 +6,12 @@
 block discarded – undo
6 6
 
7 7
 class MultiplyTest extends TestCase
8 8
 {
9
-  public function testDivide()
10
-  {
9
+    public function testDivide()
10
+    {
11 11
     $firstValue = 50;
12 12
     $secondValue = 10;
13 13
     $expectedResult = 500;
14 14
     $actualResult = multiply($firstValue)($secondValue);
15 15
     $this->assertEquals($expectedResult, $actualResult);
16
-  }
16
+    }
17 17
 }
Please login to merge, or discard this patch.
test/AppendTest.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -6,15 +6,15 @@
 block discarded – undo
6 6
 
7 7
 class AppendTest extends TestCase
8 8
 {
9
-  public function testAppend()
10
-  {
9
+    public function testAppend()
10
+    {
11 11
     $result = append(3)([1, 2]);
12 12
     $this->assertEquals([1, 2, 3], $result);
13
-  }
13
+    }
14 14
 
15
-  public function testAppendWithoutAutoCurry()
16
-  {
15
+    public function testAppendWithoutAutoCurry()
16
+    {
17 17
     $result = append(3, [1, 2]);
18 18
     $this->assertEquals([1, 2, 3], $result);
19
-  }
19
+    }
20 20
 }
Please login to merge, or discard this patch.
test/SubtractTest.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,12 +6,12 @@
 block discarded – undo
6 6
 
7 7
 class SubtractTest extends TestCase
8 8
 {
9
-  public function testDivide()
10
-  {
9
+    public function testDivide()
10
+    {
11 11
     $firstValue = 50;
12 12
     $secondValue = 10;
13 13
     $expectedResult = 40;
14 14
     $actualResult = subtract($firstValue)($secondValue);
15 15
     $this->assertEquals($expectedResult, $actualResult);
16
-  }
16
+    }
17 17
 }
Please login to merge, or discard this patch.
test/PrependTest.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -6,15 +6,15 @@
 block discarded – undo
6 6
 
7 7
 class PrependTest extends TestCase
8 8
 {
9
-  public function testAppend()
10
-  {
9
+    public function testAppend()
10
+    {
11 11
     $result = prepend(1)([2, 3]);
12 12
     $this->assertEquals([1, 2, 3], $result);
13
-  }
13
+    }
14 14
 
15
-  public function testAppendWithoutAutoCurry()
16
-  {
15
+    public function testAppendWithoutAutoCurry()
16
+    {
17 17
     $result = prepend(1, [2, 3]);
18 18
     $this->assertEquals([1, 2, 3], $result);
19
-  }
19
+    }
20 20
 }
Please login to merge, or discard this patch.
src/list.php 1 patch
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -8,20 +8,20 @@  discard block
 block discarded – undo
8 8
  */
9 9
 function all()
10 10
 {
11
-  $all = function (callable $predicateFunction, array $array): bool {
11
+    $all = function (callable $predicateFunction, array $array): bool {
12 12
     if (empty($array)) {
13
-      return false;
13
+        return false;
14 14
     }
15 15
     foreach ($array as $it) {
16
-      if (!$predicateFunction($it)) {
16
+        if (!$predicateFunction($it)) {
17 17
         return false;
18
-      }
18
+        }
19 19
     }
20 20
     return true;
21
-  };
22
-  $arguments = func_get_args();
23
-  $curried = curryN($all, 2);
24
-  return call_user_func_array($curried, $arguments);
21
+    };
22
+    $arguments = func_get_args();
23
+    $curried = curryN($all, 2);
24
+    return call_user_func_array($curried, $arguments);
25 25
 }
26 26
 
27 27
 /**
@@ -31,20 +31,20 @@  discard block
 block discarded – undo
31 31
  */
32 32
 function any()
33 33
 {
34
-  $any = function (callable $predicateFunction, array $array) {
34
+    $any = function (callable $predicateFunction, array $array) {
35 35
     if (empty($array)) {
36
-      return false;
36
+        return false;
37 37
     }
38 38
     foreach ($array as $it) {
39
-      if ($predicateFunction($it)) {
39
+        if ($predicateFunction($it)) {
40 40
         return true;
41
-      }
41
+        }
42 42
     }
43 43
     return false;
44
-  };
45
-  $arguments = func_get_args();
46
-  $curriedAny = curryN($any, 2);
47
-  return call_user_func_array($curriedAny, $arguments);
44
+    };
45
+    $arguments = func_get_args();
46
+    $curriedAny = curryN($any, 2);
47
+    return call_user_func_array($curriedAny, $arguments);
48 48
 }
49 49
 
50 50
 /**
@@ -55,12 +55,12 @@  discard block
 block discarded – undo
55 55
  */
56 56
 function append()
57 57
 {
58
-  $append = function ($item, array $array) {
58
+    $append = function ($item, array $array) {
59 59
     return array_merge($array, [$item]);
60
-  };
61
-  $arguments = func_get_args();
62
-  $curriedAny = curryN($append, 2);
63
-  return call_user_func_array($curriedAny, $arguments);
60
+    };
61
+    $arguments = func_get_args();
62
+    $curriedAny = curryN($append, 2);
63
+    return call_user_func_array($curriedAny, $arguments);
64 64
 }
65 65
 
66 66
 /**
@@ -71,12 +71,12 @@  discard block
 block discarded – undo
71 71
  */
72 72
 function concat()
73 73
 {
74
-  $concat = function (array $firstArray, array $secondArray) {
74
+    $concat = function (array $firstArray, array $secondArray) {
75 75
     return array_merge($firstArray, $secondArray);
76
-  };
77
-  $arguments = func_get_args();
78
-  $curriedAny = curryN($concat, 2);
79
-  return call_user_func_array($curriedAny, $arguments);
76
+    };
77
+    $arguments = func_get_args();
78
+    $curriedAny = curryN($concat, 2);
79
+    return call_user_func_array($curriedAny, $arguments);
80 80
 }
81 81
 
82 82
 /**
@@ -86,12 +86,12 @@  discard block
 block discarded – undo
86 86
  */
87 87
 function drop()
88 88
 {
89
-  $drop = function (int $index, array $array) {
89
+    $drop = function (int $index, array $array) {
90 90
     return array_merge(array_slice($array, 0, $index), array_slice($array, $index + 1));
91
-  };
92
-  $arguments = func_get_args();
93
-  $curried = curryN($drop, 2);
94
-  return call_user_func_array($curried, $arguments);
91
+    };
92
+    $arguments = func_get_args();
93
+    $curried = curryN($drop, 2);
94
+    return call_user_func_array($curried, $arguments);
95 95
 }
96 96
 
97 97
 /**
@@ -100,10 +100,10 @@  discard block
 block discarded – undo
100 100
  */
101 101
 function dropFirst()
102 102
 {
103
-  $dropFirst = drop(0);
104
-  $arguments = func_get_args();
105
-  $curried = curryN($dropFirst, 1);
106
-  return call_user_func_array($curried, $arguments);
103
+    $dropFirst = drop(0);
104
+    $arguments = func_get_args();
105
+    $curried = curryN($dropFirst, 1);
106
+    return call_user_func_array($curried, $arguments);
107 107
 }
108 108
 
109 109
 /**
@@ -112,14 +112,14 @@  discard block
 block discarded – undo
112 112
  */
113 113
 function dropLast()
114 114
 {
115
-  $dropLast = function (array $array) {
115
+    $dropLast = function (array $array) {
116 116
     $index = count($array)-1;
117 117
     return array_merge(array_slice($array, 0, $index), array_slice($array, $index + 1));
118
-  };
118
+    };
119 119
 
120
-  $arguments = func_get_args();
121
-  $curried = curryN($dropLast, 1);
122
-  return call_user_func_array($curried, $arguments);
120
+    $arguments = func_get_args();
121
+    $curried = curryN($dropLast, 1);
122
+    return call_user_func_array($curried, $arguments);
123 123
 }
124 124
 
125 125
 /**
@@ -129,12 +129,12 @@  discard block
 block discarded – undo
129 129
  */
130 130
 function filter()
131 131
 {
132
-  $filter = function (callable $predicateFunction, array $array) {
132
+    $filter = function (callable $predicateFunction, array $array) {
133 133
     return array_values(array_filter($array, $predicateFunction));
134
-  };
135
-  $arguments = func_get_args();
136
-  $curried = curryN($filter, 2);
137
-  return call_user_func_array($curried, $arguments);
134
+    };
135
+    $arguments = func_get_args();
136
+    $curried = curryN($filter, 2);
137
+    return call_user_func_array($curried, $arguments);
138 138
 }
139 139
 
140 140
 /**
@@ -144,12 +144,12 @@  discard block
 block discarded – undo
144 144
  */
145 145
 function filterPreserveKey()
146 146
 {
147
-  $filter = function (callable $predicateFunction, array $array) {
147
+    $filter = function (callable $predicateFunction, array $array) {
148 148
     return array_filter($array, $predicateFunction);
149
-  };
150
-  $arguments = func_get_args();
151
-  $curried = curryN($filter, 2);
152
-  return call_user_func_array($curried, $arguments);
149
+    };
150
+    $arguments = func_get_args();
151
+    $curried = curryN($filter, 2);
152
+    return call_user_func_array($curried, $arguments);
153 153
 }
154 154
 
155 155
 /**
@@ -159,9 +159,9 @@  discard block
 block discarded – undo
159 159
  */
160 160
 function map()
161 161
 {
162
-  $arguments = func_get_args();
163
-  $curried = curryN('array_map', 2);
164
-  return call_user_func_array($curried, $arguments);
162
+    $arguments = func_get_args();
163
+    $curried = curryN('array_map', 2);
164
+    return call_user_func_array($curried, $arguments);
165 165
 }
166 166
 
167 167
 /**
@@ -172,12 +172,12 @@  discard block
 block discarded – undo
172 172
  */
173 173
 function prepend()
174 174
 {
175
-  $prepend = function ($item, array $array) {
175
+    $prepend = function ($item, array $array) {
176 176
     return array_merge([$item], $array);
177
-  };
178
-  $arguments = func_get_args();
179
-  $curriedAny = curryN($prepend, 2);
180
-  return call_user_func_array($curriedAny, $arguments);
177
+    };
178
+    $arguments = func_get_args();
179
+    $curriedAny = curryN($prepend, 2);
180
+    return call_user_func_array($curriedAny, $arguments);
181 181
 }
182 182
 
183 183
 /**
@@ -188,10 +188,10 @@  discard block
 block discarded – undo
188 188
  */
189 189
 function reduce()
190 190
 {
191
-  $reduce = function (callable $accumulator, $initialValue, array $array) {
191
+    $reduce = function (callable $accumulator, $initialValue, array $array) {
192 192
     return array_reduce($array, $accumulator, $initialValue);
193
-  };
194
-  $arguments = func_get_args();
195
-  $curried = curryN($reduce, 3);
196
-  return call_user_func_array($curried, $arguments);
193
+    };
194
+    $arguments = func_get_args();
195
+    $curried = curryN($reduce, 3);
196
+    return call_user_func_array($curried, $arguments);
197 197
 }
Please login to merge, or discard this patch.