FixedMapping::inProperty()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 3
rs 10
1
<?php declare(strict_types=1);
2
3
namespace Stratadox\Hydration\Mapping;
4
5
use Stratadox\HydrationMapping\Mapping;
6
7
final class FixedMapping implements Mapping
8
{
9
    /** @var string */
10
    private $name;
11
    /** @var mixed */
12
    private $value;
13
14
    /** @param mixed $value */
15
    private function __construct(string $name, $value)
16
    {
17
        $this->name = $name;
18
        $this->value = $value;
19
    }
20
21
    /**
22
     * @param string $name
23
     * @param mixed  $value
24
     * @return Mapping
25
     */
26
    public static function inProperty(string $name, $value): Mapping
27
    {
28
        return new self($name, $value);
29
    }
30
31
    public function name(): string
32
    {
33
        return $this->name;
34
    }
35
36
    public function value(array $data, $owner = null)
37
    {
38
        return $this->value;
39
    }
40
}
41