FixedMapping   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 32
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A inProperty() 0 3 1
A name() 0 3 1
A value() 0 3 1
A __construct() 0 4 1
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