Metadata::readyToTransformation()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 *
4
 * This file is part of the Aggrego.
5
 * (c) Tomasz Kunicki <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 */
11
12
declare(strict_types = 1);
13
14
namespace Aggrego\FragmentedDataBoardDomain\Board;
15
16
use Aggrego\FragmentedDataBoardDomain\Board\Shard\Collection;
17
use Aggrego\FragmentedDataBoardDomain\Board\Shard\FinalItem;
18
use Aggrego\Domain\Board\Metadata as DomainMetadata;
19
20
class Metadata implements DomainMetadata
21
{
22
    /** @var State */
23
    private $state;
24
25
    /** @var Collection */
26
    private $shards;
27
28
    public function __construct(State $state, Collection $shards)
29
    {
30
        $this->state = $state;
31
        $this->shards = $shards;
32
    }
33
34
    public function getState(): State
35
    {
36
        return $this->state;
37
    }
38
39
    public function replace(FinalItem $finalItem): void
40
    {
41
        $this->shards->replace($finalItem);
42
    }
43
44
    public function getShards(): Collection
45
    {
46
        return $this->shards;
47
    }
48
49
    public function readyToTransformation(): bool
50
    {
51
        return $this->shards->isAllShardsFinishedProgress();
52
    }
53
}
54