@@ -22,8 +22,8 @@ |
||
| 22 | 22 | private $valueMapper; |
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | - * @param \Closure|BinaryFunctionInterface $keyMapper |
|
| 26 | - * @param \Closure|BinaryFunctionInterface $valueMapper |
|
| 25 | + * @param callable $keyMapper |
|
| 26 | + * @param \PeekAndPoke\Component\Psi\Functions\Unary\Mapper\IdentityMapper $valueMapper |
|
| 27 | 27 | */ |
| 28 | 28 | public function __construct($keyMapper, $valueMapper) |
| 29 | 29 | { |
@@ -38,13 +38,13 @@ |
||
| 38 | 38 | */ |
| 39 | 39 | public function apply(\Iterator $set) |
| 40 | 40 | { |
| 41 | - $result = []; |
|
| 41 | + $result = [ ]; |
|
| 42 | 42 | |
| 43 | 43 | $keyMapper = $this->keyMapper; |
| 44 | 44 | $valueMapper = $this->valueMapper; |
| 45 | 45 | |
| 46 | 46 | foreach ($set as $key => $item) { |
| 47 | - $result[$keyMapper($item, $key)] = $valueMapper($item, $key); |
|
| 47 | + $result[ $keyMapper($item, $key) ] = $valueMapper($item, $key); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | return $result; |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public static function isValidDateString($str) |
| 34 | 34 | { |
| 35 | - if (!is_string($str)) { |
|
| 35 | + if ( ! is_string($str)) { |
|
| 36 | 36 | return false; |
| 37 | 37 | } |
| 38 | 38 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | $stamp = strtotime($str); |
| 44 | 44 | |
| 45 | - if (!is_numeric($stamp)) { |
|
| 45 | + if ( ! is_numeric($stamp)) { |
|
| 46 | 46 | return false; |
| 47 | 47 | } |
| 48 | 48 | |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | { |
| 26 | 26 | $val = $this->getValue(); |
| 27 | 27 | |
| 28 | - if (!$val instanceof LocalDate || !$input instanceof LocalDate) { |
|
| 28 | + if ( ! $val instanceof LocalDate || ! $input instanceof LocalDate) { |
|
| 29 | 29 | return false; |
| 30 | 30 | } |
| 31 | 31 | |
@@ -21,13 +21,13 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | public function apply(\Iterator $set) |
| 23 | 23 | { |
| 24 | - $ret = []; |
|
| 24 | + $ret = [ ]; |
|
| 25 | 25 | $func = $this->function; |
| 26 | 26 | |
| 27 | 27 | foreach ($set as $item) { |
| 28 | 28 | $group = $func($item); |
| 29 | 29 | |
| 30 | - $ret[$group][] = $item; |
|
| 30 | + $ret[ $group ][ ] = $item; |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | return new \ArrayIterator($ret); |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | |
| 31 | 31 | usort( |
| 32 | 32 | $data, |
| 33 | - function ($i1, $i2) use ($func) { |
|
| 33 | + function($i1, $i2) use ($func) { |
|
| 34 | 34 | |
| 35 | 35 | $val1 = $func($i1); |
| 36 | 36 | $val2 = $func($i2); |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | $count = count($iteratables); |
| 35 | 35 | |
| 36 | 36 | if ($count == 1) { |
| 37 | - return $this->createSingleIterator($iteratables[0]); |
|
| 37 | + return $this->createSingleIterator($iteratables[ 0 ]); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | if ($count > 1) { |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | public function __construct($input, $timezone) |
| 61 | 61 | { |
| 62 | - if (! $timezone instanceof \DateTimeZone) { |
|
| 62 | + if ( ! $timezone instanceof \DateTimeZone) { |
|
| 63 | 63 | $timezone = new \DateTimeZone((string) $timezone); |
| 64 | 64 | } |
| 65 | 65 | |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | * |
| 206 | 206 | * @return LocalDate |
| 207 | 207 | */ |
| 208 | - public function getDstStartOfDayPlusHours ($hours) |
|
| 208 | + public function getDstStartOfDayPlusHours($hours) |
|
| 209 | 209 | { |
| 210 | 210 | $startOfDay = $this->getStartOfDay(); |
| 211 | 211 | $startOfDayOffset = $startOfDay->getOffset(); |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | */ |
| 369 | 369 | public function addInterval($interval) |
| 370 | 370 | { |
| 371 | - if (!$interval instanceof \DateInterval) { |
|
| 371 | + if ( ! $interval instanceof \DateInterval) { |
|
| 372 | 372 | $interval = new \DateInterval($interval); |
| 373 | 373 | } |
| 374 | 374 | |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | */ |
| 386 | 386 | public function subInterval($interval) |
| 387 | 387 | { |
| 388 | - if (!$interval instanceof \DateInterval) { |
|
| 388 | + if ( ! $interval instanceof \DateInterval) { |
|
| 389 | 389 | $interval = new \DateInterval($interval); |
| 390 | 390 | } |
| 391 | 391 | |
@@ -405,9 +405,9 @@ discard block |
||
| 405 | 405 | // This is a work-around for the day-light-saving shift days |
| 406 | 406 | // If we would use minutesIntoDay and then add those to startOfDay, we loose one hour. |
| 407 | 407 | // Example would be '2015-03-29 11:20' with tz 'Europe/Berlin' would result in '2015-03-29 10:00' |
| 408 | - $minutesIntoDay = ((int)$this->date->format('H') * 60) + ((int)$this->date->format('i')); |
|
| 408 | + $minutesIntoDay = ((int) $this->date->format('H') * 60) + ((int) $this->date->format('i')); |
|
| 409 | 409 | // cut off partial intervals |
| 410 | - $corrected = ((int)($minutesIntoDay / $minutesInterval)) * $minutesInterval; |
|
| 410 | + $corrected = ((int) ($minutesIntoDay / $minutesInterval)) * $minutesInterval; |
|
| 411 | 411 | |
| 412 | 412 | return $this->getStartOfDay()->modifyByMinutes($corrected); |
| 413 | 413 | } |