NestedAccessorFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A fromArray() 0 3 1
A create() 0 3 1
A fromObject() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Smoren\Schemator\Factories;
6
7
use Smoren\Schemator\Components\NestedAccessor;
8
use Smoren\Schemator\Interfaces\NestedAccessorFactoryInterface;
9
use Smoren\Schemator\Interfaces\NestedAccessorInterface;
10
11
class NestedAccessorFactory implements NestedAccessorFactoryInterface
12
{
13
    /**
14
     * {@inheritDoc}
15
     */
16
    public static function create(&$source, string $pathDelimiter = '.'): NestedAccessorInterface
17
    {
18
        return new NestedAccessor($source, $pathDelimiter);
19
    }
20
21
    /**
22
     * {@inheritDoc}
23
     */
24
    public static function fromArray(array &$source, string $pathDelimiter = '.'): NestedAccessorInterface
25
    {
26
        return static::create($source, $pathDelimiter);
27
    }
28
29
    /**
30
     * {@inheritDoc}
31
     */
32
    public static function fromObject(object &$source, string $pathDelimiter = '.'): NestedAccessorInterface
33
    {
34
        return static::create($source, $pathDelimiter);
35
    }
36
}
37