@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | function and_() { |
| 24 | 24 | static $and = false; |
| 25 | - $and = $and ?: curry(function($a, $b){ |
|
| 25 | + $and = $and ?: curry(function($a, $b) { |
|
| 26 | 26 | return $a && $b; |
| 27 | 27 | }); |
| 28 | 28 | return _apply($and, func_get_args()); |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | function or_() { |
| 47 | 47 | static $or = false; |
| 48 | - $or = $or ?: curry(function($a, $b){ |
|
| 48 | + $or = $or ?: curry(function($a, $b) { |
|
| 49 | 49 | return $a || $b; |
| 50 | 50 | }); |
| 51 | 51 | return _apply($or, func_get_args()); |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | * @return bool |
| 86 | 86 | */ |
| 87 | 87 | function eq() { |
| 88 | - $eq = curry(function($a, $b){ |
|
| 88 | + $eq = curry(function($a, $b) { |
|
| 89 | 89 | return $a == $b; |
| 90 | 90 | }); |
| 91 | 91 | return _apply($eq, func_get_args()); |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | function notEq() { |
| 108 | 108 | static $notEq = false; |
| 109 | - $notEq = $notEq ?: curry(function($a, $b){ |
|
| 109 | + $notEq = $notEq ?: curry(function($a, $b) { |
|
| 110 | 110 | return $a != $b; |
| 111 | 111 | }); |
| 112 | 112 | return _apply($notEq, func_get_args()); |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | */ |
| 127 | 127 | function eqq() { |
| 128 | 128 | static $eqq = false; |
| 129 | - $eqq = $eqq ?: curry(function($a, $b){ |
|
| 129 | + $eqq = $eqq ?: curry(function($a, $b) { |
|
| 130 | 130 | return $a === $b; |
| 131 | 131 | }); |
| 132 | 132 | return _apply($eqq, func_get_args()); |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | function notEqq() { |
| 149 | 149 | static $notEqq = false; |
| 150 | - $notEqq = $notEqq ?: curry(function($a, $b){ |
|
| 150 | + $notEqq = $notEqq ?: curry(function($a, $b) { |
|
| 151 | 151 | return $a !== $b; |
| 152 | 152 | }); |
| 153 | 153 | return _apply($notEqq, func_get_args()); |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | */ |
| 265 | 265 | function lt() { |
| 266 | 266 | static $lt = false; |
| 267 | - $lt = $lt ?: curry(function($a, $b){ |
|
| 267 | + $lt = $lt ?: curry(function($a, $b) { |
|
| 268 | 268 | return $a < $b; |
| 269 | 269 | }); |
| 270 | 270 | return _apply($lt, func_get_args()); |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | */ |
| 287 | 287 | function lte() { |
| 288 | 288 | static $lte = false; |
| 289 | - $lte = $lte ?: curry(function($a, $b){ |
|
| 289 | + $lte = $lte ?: curry(function($a, $b) { |
|
| 290 | 290 | return $a <= $b; |
| 291 | 291 | }); |
| 292 | 292 | return _apply($lte, func_get_args()); |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | */ |
| 309 | 309 | function gt() { |
| 310 | 310 | static $gt = false; |
| 311 | - $gt = $gt ?: curry(function($a, $b){ |
|
| 311 | + $gt = $gt ?: curry(function($a, $b) { |
|
| 312 | 312 | return $a > $b; |
| 313 | 313 | }); |
| 314 | 314 | return _apply($gt, func_get_args()); |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | */ |
| 331 | 331 | function gte() { |
| 332 | 332 | static $gte = false; |
| 333 | - $gte = $gte ?: curry(function($a, $b){ |
|
| 333 | + $gte = $gte ?: curry(function($a, $b) { |
|
| 334 | 334 | return $a >= $b; |
| 335 | 335 | }); |
| 336 | 336 | return _apply($gte, func_get_args()); |
@@ -35,8 +35,7 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | function _number_of_args($fn) { |
| 37 | 37 | $reflector = is_array($fn) ? |
| 38 | - new \ReflectionMethod($fn[0], $fn[1]) : |
|
| 39 | - new \ReflectionFunction($fn); |
|
| 38 | + new \ReflectionMethod($fn[0], $fn[1]) : new \ReflectionFunction($fn); |
|
| 40 | 39 | return $reflector->getNumberOfRequiredParameters(); |
| 41 | 40 | } |
| 42 | 41 | |
@@ -85,7 +84,7 @@ discard block |
||
| 85 | 84 | function _curry_one($fn) { |
| 86 | 85 | return function() use($fn) { |
| 87 | 86 | $args = func_get_args(); |
| 88 | - return (count($args) > 0 && ! _is_placeholder($args[0])) |
|
| 87 | + return (count($args) > 0 && !_is_placeholder($args[0])) |
|
| 89 | 88 | ? $fn($args[0]) |
| 90 | 89 | : _curry_one($fn); |
| 91 | 90 | }; |
@@ -79,8 +79,8 @@ |
||
| 79 | 79 | */ |
| 80 | 80 | function averageTime($n, $path, $test) { |
| 81 | 81 | $s = 0; |
| 82 | - for ($i=0; $i < $n; $i++) { |
|
| 83 | - $s =+ execute($path, $test->input); |
|
| 82 | + for ($i = 0; $i < $n; $i ++) { |
|
| 83 | + $s = + execute($path, $test->input); |
|
| 84 | 84 | } |
| 85 | 85 | return $s / $n; |
| 86 | 86 | } |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -require __DIR__.'/../../vendor/autoload.php'; |
|
| 2 | +require __DIR__ . '/../../vendor/autoload.php'; |
|
| 3 | 3 | |
| 4 | 4 | use Tarsana\Functional as F; |
| 5 | 5 | use Tarsana\Functional\Stream; |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | |
| 7 | 7 | $words = []; |
| 8 | 8 | foreach ($text as $word => $occ) { |
| 9 | - if (! isset($words[$occ])) { |
|
| 9 | + if (!isset($words[$occ])) { |
|
| 10 | 10 | $words[$occ] = []; |
| 11 | 11 | } |
| 12 | 12 | $words[$occ][] = $word; |
@@ -8,10 +8,10 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | class Placeholder { |
| 10 | 10 | private static $instance; |
| 11 | - private function __construct(){} |
|
| 11 | + private function __construct() {} |
|
| 12 | 12 | public static function get() |
| 13 | 13 | { |
| 14 | - if(static::$instance === null) |
|
| 14 | + if (static::$instance === null) |
|
| 15 | 15 | static::$instance = new Placeholder; |
| 16 | 16 | return static::$instance; |
| 17 | 17 | } |