Passed
Push — master ( 72f38a...596bea )
by Smoren
02:21
created

SilentNestedAccessorFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

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

3 Methods

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