ToLocalDate   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 3
dl 0
loc 18
c 0
b 0
f 0
ccs 5
cts 5
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 3 1
A __construct() 0 3 1
1
<?php
2
/**
3
 * File was created 02.10.2015 11:35
4
 *
5
 * @author Karsten J. Gerber <[email protected]>
6
 */
7
8
namespace PeekAndPoke\Component\Psi\Psi\Str;
9
10
use PeekAndPoke\Component\Psi\Functions\ParameterizedUnaryFunction;
11
use PeekAndPoke\Types\LocalDate;
12
use PeekAndPoke\Types\ValueHolder;
13
14
/**
15
 * ToLocalDate maps a string to a LocalDate object using the given parameter as the timezone
16
 *
17
 * @see    ParameterizedUnaryFunction
18
 * @see    ToLocalDateTest
19
 *
20
 * @author Karsten J. Gerber <[email protected]>
21
 */
22
class ToLocalDate extends ParameterizedUnaryFunction
23
{
24
    /**
25
     * @param string|\DateTimeZone|ValueHolder $timezone
26
     */
27 2
    public function __construct($timezone)
28
    {
29 2
        parent::__construct($timezone);
30 2
    }
31
32
    /**
33
     * @param mixed $input
34
     *
35
     * @return LocalDate
36
     */
37 2
    public function __invoke($input)
38
    {
39 2
        return new LocalDate($input, $this->getValue());
40
    }
41
}
42