Completed
Push — Lonja/albertc ( 7a2bf6 )
by Albert
20:41 queued 16:20
created

Product::instance()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Kata\Domain\Product\Model;
6
use Kata\Domain\Common\ValueObject\AggregateRoot;
7
use Kata\Domain\Product\ValueObject\ProductId;
8
9
class Product extends AggregateRoot
10
{
11
    /** @var string  */
12
    private $name;
13
14
    public function __construct(ProductId $productId, string $name)
15
    {
16
        parent::__construct($productId);
17
        $this->name = $name;
18
    }
19
20
    public static function instance(ProductId $productId, string $name): Product
21
    {
22
        return new self($productId, $name);
23
    }
24
25
    public function name(): string
26
    {
27
        return $this->name;
28
    }
29
}
30