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

Product   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 21
ccs 0
cts 13
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A instance() 0 4 1
A name() 0 4 1
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