Completed
Push — master ( 1358d6...984c1e )
by Karsten
01:40
created

IsSameDay::__invoke()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 3

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 10
ccs 5
cts 5
cp 1
rs 9.4285
cc 3
eloc 5
nc 2
nop 1
crap 3
1
<?php
2
/**
3
 * File was created 01.10.2015 18:02
4
 *
5
 * @author Karsten J. Gerber <[email protected]>
6
 */
7
namespace PeekAndPoke\Component\Psi\Psi;
8
9
use PeekAndPoke\Component\Psi\Functions\Unary\AbstractParameterizedUnaryFunction;
10
use PeekAndPoke\Types\LocalDate;
11
12
/**
13
 * IsSameDay
14
 *
15
 * @author Karsten J. Gerber <[email protected]>
16
 */
17
class IsSameDay extends AbstractParameterizedUnaryFunction
18
{
19
    /**
20
     * @param mixed $input
21
     *
22
     * @return bool
23
     */
24 14
    public function __invoke($input)
25
    {
26 14
        $val = $this->getValue();
27
28 14
        if (!$val instanceof LocalDate || !$input instanceof LocalDate) {
29 4
            return false;
30
        }
31
32 10
        return $val->getStartOfDay()->isEqual($input->getStartOfDay());
33
    }
34
}
35