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

ValueObject::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 1
crap 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
}