Passed
Push — master ( d3a94c...76e109 )
by Valentin
05:50
created

Name::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Cycle\ORM\Promise\ConflictResolver;
5
6
class Name
7
{
8
    /** @var string */
9
    public $name;
10
11
    /** @var int */
12
    public $sequence = 0;
13
14
    public static function createWithSequence(string $name, int $sequence): Name
15
    {
16
        $self = new self();
17
        $self->name = $name;
18
        $self->sequence = $sequence;
19
20
        return $self;
21
    }
22
23
    public static function create(string $name): Name
24
    {
25
        $self = new self();
26
        $self->name = $name;
27
28
        return $self;
29
    }
30
31
    public function fullName(): string
32
    {
33
        $name = $this->name;
34
        if ($this->sequence > 0) {
35
            $name .= $this->sequence;
36
        }
37
38
        return $name;
39
    }
40
41
    protected function __construct()
42
    {
43
    }
44
}