Completed
Push — master ( d8ac6c...cd03ce )
by Jesse
02:57
created

HasBackReference::inProperty()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stratadox\Hydration\Mapping\Property\Relationship;
6
7
use Stratadox\Hydration\MapsProperty;
8
9
/**
10
 * Maps a back-reference in a bidirectional relationship.
11
 *
12
 * @package Stratadox\Hydrate
13
 * @author Stratadox
14
 */
15
class HasBackReference implements MapsProperty
16
{
17
    private $name;
18
19
    protected function __construct(string $name)
20
    {
21
        $this->name = $name;
22
    }
23
24
    public static function inProperty(string $name) : MapsProperty
25
    {
26
        return new static($name);
27
    }
28
29
    public function name() : string
30
    {
31
        return $this->name;
32
    }
33
34
    /** @inheritdoc @return mixed|object */
35
    public function value(array $data, $owner = null)
36
    {
37
        return $owner;
38
    }
39
}
40