Completed
Pull Request — master (#20)
by Siwapun
06:34 queued 04:49
created
test/InsertTest.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -8,27 +8,27 @@
 block discarded – undo
8 8
 class InsertTest extends TestCase
9 9
 {
10 10
 
11
-  public function testInsertFirst()
12
-  {
11
+    public function testInsertFirst()
12
+    {
13 13
     $array = [1, 2, 3, 4, 5];
14 14
     $expected = ['newItem', 1, 2, 3, 4, 5];
15 15
     $actual = insert(0)('newItem')($array);
16 16
     $this->assertEquals($expected, $actual);
17
-  }
17
+    }
18 18
 
19
-  public function testInsertLast()
20
-  {
19
+    public function testInsertLast()
20
+    {
21 21
     $array = [1, 2, 3, 4, 5];
22 22
     $expected = [1, 2, 3, 4, 5, 'newItem'];
23 23
     $actual = insert(5)('newItem')($array);
24 24
     $this->assertEquals($expected, $actual);
25
-  }
25
+    }
26 26
 
27
-  public function testInsertNth()
28
-  {
27
+    public function testInsertNth()
28
+    {
29 29
     $array = [1, 2, 3, 4, 5];
30 30
     $expected = [1, 2,  'newItem', 3, 4, 5];
31 31
     $actual = insert(2)('newItem')($array);
32 32
     $this->assertEquals($expected, $actual);
33
-  }
33
+    }
34 34
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
   public function testInsertNth()
28 28
   {
29 29
     $array = [1, 2, 3, 4, 5];
30
-    $expected = [1, 2,  'newItem', 3, 4, 5];
30
+    $expected = [1, 2, 'newItem', 3, 4, 5];
31 31
     $actual = insert(2)('newItem')($array);
32 32
     $this->assertEquals($expected, $actual);
33 33
   }
Please login to merge, or discard this patch.
src/type.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
  */
7 7
 function isNil()
8 8
 {
9
-  $arguments = func_get_args();
10
-  $curried = curryN('is_null', 1);
11
-  return call_user_func_array($curried, $arguments);
9
+    $arguments = func_get_args();
10
+    $curried = curryN('is_null', 1);
11
+    return call_user_func_array($curried, $arguments);
12 12
 }
Please login to merge, or discard this patch.
src/logic.php 2 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -8,22 +8,22 @@  discard block
 block discarded – undo
8 8
  */
9 9
 function andLogically()
10 10
 {
11
-  $and = function (bool $firstValue, bool $secondValue) {
11
+    $and = function (bool $firstValue, bool $secondValue) {
12 12
     return $firstValue && $secondValue;
13
-  };
14
-  $arguments = func_get_args();
15
-  $curried = curryN($and, 2);
16
-  return call_user_func_array($curried, $arguments);
13
+    };
14
+    $arguments = func_get_args();
15
+    $curried = curryN($and, 2);
16
+    return call_user_func_array($curried, $arguments);
17 17
 }
18 18
 
19 19
 function defaultTo()
20 20
 {
21
-  $defaultTo = function ($defaultValue, $value) {
21
+    $defaultTo = function ($defaultValue, $value) {
22 22
     return $value ? $value : $defaultValue;
23
-  };
24
-  $arguments = func_get_args();
25
-  $curried = curryN($defaultTo, 2);
26
-  return call_user_func_array($curried, $arguments);
23
+    };
24
+    $arguments = func_get_args();
25
+    $curried = curryN($defaultTo, 2);
26
+    return call_user_func_array($curried, $arguments);
27 27
 }
28 28
 
29 29
 /**
@@ -35,18 +35,18 @@  discard block
 block discarded – undo
35 35
  */
36 36
 function ifElse()
37 37
 {
38
-  $ifElse = function (callable $condition, callable $onTrue, callable $onFalse) {
38
+    $ifElse = function (callable $condition, callable $onTrue, callable $onFalse) {
39 39
     return function () use ($condition, $onTrue, $onFalse) {
40
-      $arguments = func_get_args();
41
-      if (call_user_func_array($condition, $arguments)) {
40
+        $arguments = func_get_args();
41
+        if (call_user_func_array($condition, $arguments)) {
42 42
         return call_user_func_array($onTrue, $arguments);
43
-      }
44
-      return call_user_func_array($onFalse, $arguments);
43
+        }
44
+        return call_user_func_array($onFalse, $arguments);
45
+    };
45 46
     };
46
-  };
47
-  $arguments = func_get_args();
48
-  $curried = curryN($ifElse, 3);
49
-  return call_user_func_array($curried, $arguments);
47
+    $arguments = func_get_args();
48
+    $curried = curryN($ifElse, 3);
49
+    return call_user_func_array($curried, $arguments);
50 50
 }
51 51
 
52 52
 /**
@@ -55,12 +55,12 @@  discard block
 block discarded – undo
55 55
  */
56 56
 function isEmpty()
57 57
 {
58
-  $isEmpty = function ($value) {
58
+    $isEmpty = function ($value) {
59 59
     return empty($value);
60
-  };
61
-  $arguments = func_get_args();
62
-  $curried = curryN($isEmpty, 1);
63
-  return call_user_func_array($curried, $arguments);
60
+    };
61
+    $arguments = func_get_args();
62
+    $curried = curryN($isEmpty, 1);
63
+    return call_user_func_array($curried, $arguments);
64 64
 }
65 65
 
66 66
 /**
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
  */
71 71
 function orLogically()
72 72
 {
73
-  $and = function (bool $firstValue, bool $secondValue) {
73
+    $and = function (bool $firstValue, bool $secondValue) {
74 74
     return $firstValue || $secondValue;
75
-  };
76
-  $arguments = func_get_args();
77
-  $curried = curryN($and, 2);
78
-  return call_user_func_array($curried, $arguments);
75
+    };
76
+    $arguments = func_get_args();
77
+    $curried = curryN($and, 2);
78
+    return call_user_func_array($curried, $arguments);
79 79
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  */
9 9
 function andLogically()
10 10
 {
11
-  $and = function (bool $firstValue, bool $secondValue) {
11
+  $and = function(bool $firstValue, bool $secondValue) {
12 12
     return $firstValue && $secondValue;
13 13
   };
14 14
   $arguments = func_get_args();
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 
19 19
 function defaultTo()
20 20
 {
21
-  $defaultTo = function ($defaultValue, $value) {
21
+  $defaultTo = function($defaultValue, $value) {
22 22
     return $value ? $value : $defaultValue;
23 23
   };
24 24
   $arguments = func_get_args();
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
  */
36 36
 function ifElse()
37 37
 {
38
-  $ifElse = function (callable $condition, callable $onTrue, callable $onFalse) {
39
-    return function () use ($condition, $onTrue, $onFalse) {
38
+  $ifElse = function(callable $condition, callable $onTrue, callable $onFalse) {
39
+    return function() use ($condition, $onTrue, $onFalse) {
40 40
       $arguments = func_get_args();
41 41
       if (call_user_func_array($condition, $arguments)) {
42 42
         return call_user_func_array($onTrue, $arguments);
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
  */
56 56
 function isEmpty()
57 57
 {
58
-  $isEmpty = function ($value) {
58
+  $isEmpty = function($value) {
59 59
     return empty($value);
60 60
   };
61 61
   $arguments = func_get_args();
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
  */
71 71
 function orLogically()
72 72
 {
73
-  $and = function (bool $firstValue, bool $secondValue) {
73
+  $and = function(bool $firstValue, bool $secondValue) {
74 74
     return $firstValue || $secondValue;
75 75
   };
76 76
   $arguments = func_get_args();
Please login to merge, or discard this patch.
test/MatchTest.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,21 +7,21 @@
 block discarded – undo
7 7
 
8 8
 class MatchTest extends TestCase
9 9
 {
10
-  public function testMatch()
11
-  {
10
+    public function testMatch()
11
+    {
12 12
     $pattern = '/^([a-z]+)-([0-9]+)$/';
13 13
     $testString = 'cat-009';
14 14
     $expect = ['cat-009', 'cat', '009'];
15 15
     $actual = match($pattern, $testString);
16 16
     $this->assertEquals($expect, $actual);
17
-  }
17
+    }
18 18
 
19
-  public function testUnmatch()
20
-  {
19
+    public function testUnmatch()
20
+    {
21 21
     $pattern = '/^([a-z]+)-([0-9]+)$/';
22 22
     $testString = 'cat009';
23 23
     $expect = [];
24 24
     $actual = match($pattern, $testString);
25 25
     $this->assertEquals($expect, $actual);
26
-  }
26
+    }
27 27
 }
Please login to merge, or discard this patch.
test/JoinTest.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,11 +7,11 @@
 block discarded – undo
7 7
 
8 8
 class JoinTest extends TestCase
9 9
 {
10
-  public function testJoinWithComma()
11
-  {
10
+    public function testJoinWithComma()
11
+    {
12 12
     $array = [1, 2, 3];
13 13
     $expect = '1,2,3';
14 14
     $actual = join(',')($array);
15 15
     $this->assertEquals($expect, $actual);
16
-  }
16
+    }
17 17
 }
Please login to merge, or discard this patch.
test/LengthTest.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,11 +7,11 @@
 block discarded – undo
7 7
 
8 8
 class LengthTest extends TestCase
9 9
 {
10
-  public function testLength()
11
-  {
10
+    public function testLength()
11
+    {
12 12
     $array = [1, 2, 3, 4, 5];
13 13
     $expect = 5;
14 14
     $actual = length()($array);
15 15
     $this->assertEquals($expect, $actual);
16
-  }
16
+    }
17 17
 }
Please login to merge, or discard this patch.
src/string.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,11 +8,11 @@
 block discarded – undo
8 8
  */
9 9
 function match()
10 10
 {
11
-  $match = function (string $pattern, string $string) {
11
+    $match = function (string $pattern, string $string) {
12 12
     preg_match($pattern, $string, $matches);
13 13
     return $matches;
14
-  };
15
-  $arguments = func_get_args();
16
-  $curried = curryN($match, 2);
17
-  return call_user_func_array($curried, $arguments);
14
+    };
15
+    $arguments = func_get_args();
16
+    $curried = curryN($match, 2);
17
+    return call_user_func_array($curried, $arguments);
18 18
 }
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 match()
10 10
 {
11
-  $match = function (string $pattern, string $string) {
11
+  $match = function(string $pattern, string $string) {
12 12
     preg_match($pattern, $string, $matches);
13 13
     return $matches;
14 14
   };
Please login to merge, or discard this patch.
test/MedianTest.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,19 +7,19 @@
 block discarded – undo
7 7
 
8 8
 class MedianTest extends TestCase
9 9
 {
10
-  public function testMedianWithOddNumberOfArguments()
11
-  {
10
+    public function testMedianWithOddNumberOfArguments()
11
+    {
12 12
     $numbers = [2, 9, 7];
13 13
     $expect = 7;
14 14
     $actual = median()($numbers);
15 15
     $this->assertEquals($expect, $actual);
16
-  }
16
+    }
17 17
 
18
-  public function testMedianWithEvenNumberOfArguments()
19
-  {
18
+    public function testMedianWithEvenNumberOfArguments()
19
+    {
20 20
     $numbers = [7, 2, 10, 9];
21 21
     $expect = 8;
22 22
     $actual = median()($numbers);
23 23
     $this->assertEquals($expect, $actual);
24
-  }
24
+    }
25 25
 }
Please login to merge, or discard this patch.
test/MeanTest.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,18 +7,18 @@
 block discarded – undo
7 7
 
8 8
 class MeanTest extends TestCase
9 9
 {
10
-  public function testMean()
11
-  {
10
+    public function testMean()
11
+    {
12 12
     $numbers = [2, 7, 9];
13 13
     $expect = 6;
14 14
     $actual = mean()($numbers);
15 15
     $this->assertEquals($expect, $actual);
16
-  }
16
+    }
17 17
 
18
-  public function testMeanWithEmptyArray()
19
-  {
18
+    public function testMeanWithEmptyArray()
19
+    {
20 20
     $this->expectException(\InvalidArgumentException::class);
21 21
     $numbers = [];
22 22
     mean()($numbers);
23
-  }
23
+    }
24 24
 }
Please login to merge, or discard this patch.