Total Complexity | 4 |
Total Lines | 26 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
8 | final class ClosureMapping implements Mapping |
||
9 | { |
||
10 | /** @var string */ |
||
11 | private $property; |
||
12 | /** @var Closure */ |
||
13 | private $function; |
||
14 | |||
15 | private function __construct(string $property, Closure $function) |
||
16 | { |
||
17 | $this->property = $property; |
||
18 | $this->function = $function; |
||
19 | } |
||
20 | |||
21 | public static function inProperty(string $name, Closure $function): Mapping |
||
22 | { |
||
23 | return new self($name, $function); |
||
24 | } |
||
25 | |||
26 | public function name(): string |
||
27 | { |
||
28 | return $this->property; |
||
29 | } |
||
30 | |||
31 | public function value(array $data, $owner = null) |
||
34 | } |
||
35 | } |
||
36 |