Passed
Push — master ( a0b884...c45d95 )
by Jesse
03:03
created

Properties   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 30
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A map() 0 5 1
A current() 0 3 1
A offsetGet() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stratadox\Hydration\Mapping;
6
7
use Closure;
8
use Stratadox\HydrationMapping\MapsProperties;
9
use Stratadox\HydrationMapping\MapsProperty;
10
use Stratadox\ImmutableCollection\ImmutableCollection;
11
12
/**
13
 * Defines how to map a specific structure of data to an object.
14
 *
15
 * @package Stratadox\Hydrate
16
 * @author Stratadox
17
 */
18
final class Properties extends ImmutableCollection implements MapsProperties
19
{
20
    public function __construct(MapsProperty ...$properties)
21
    {
22
        parent::__construct(...$properties);
23
    }
24
25
    /**
26
     * Creates a new list of property mappings.
27
     *
28
     * @param MapsProperty[] ...$properties The property mappings.
29
     * @return Properties                   The property mapping container.
30
     */
31
    public static function map(
32
        MapsProperty ...$properties
33
    ) : self
34
    {
35
        return new self(...$properties);
36
    }
37
38
    /** @inheritdoc */
39
    public function current() : MapsProperty
40
    {
41
        return parent::current();
42
    }
43
44
    /** @inheritdoc */
45
    public function offsetGet($offset) : MapsProperty
46
    {
47
        return parent::offsetGet($offset);
48
    }
49
}
50