Passed
Push — master ( db3d0f...fd00a0 )
by Claudio
08:00
created

ValueObject   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 6
c 1
b 0
f 0
dl 0
loc 21
ccs 6
cts 6
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A create() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Budgegeria\IntlSort\ComparatorFactory;
6
7
use Budgegeria\IntlSort\Comparator\Comparable;
8
use Budgegeria\IntlSort\Comparator\ValueObject as Comparator;
9
use Collator;
10
11
class ValueObject implements Factory
12
{
13
    /**
14
     * @var string
15
     */
16
    private $methodOrPropertyName;
17
18
    /**
19
     * @var bool
20
     */
21
    private $isProperty;
22
23 2
    public function __construct(string $name, bool $isProperty = false)
24
    {
25 2
        $this->methodOrPropertyName = $name;
26 2
        $this->isProperty = $isProperty;
27 2
    }
28
29 2
    public function create(Collator $collator): Comparable
30
    {
31 2
        return new Comparator($collator, $this->methodOrPropertyName, $this->isProperty);
32
    }
33
}