Passed
Push — master ( 023570...3c9f2b )
by Aleksandr
02:49
created

EntityFactoryResult::setEntityKey()   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 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * This file is part of the eav package.
4
 * @author    Aleksandr Drobotik <[email protected]>
5
 * @copyright 2023 Aleksandr Drobotik
6
 * @license   https://opensource.org/license/mit  The MIT License
7
 */
8
declare(strict_types=1);
9
10
namespace Drobotik\Eav\Result;
11
12
use Drobotik\Eav\Model\AttributeModel;
13
use Drobotik\Eav\Model\EntityModel;
14
use Drobotik\Eav\Model\PivotModel;
15
use Drobotik\Eav\Model\ValueBase;
16
17
class EntityFactoryResult
18
{
19
    private int $entityKey;
20
    /** @var PivotModel[] */
21
    private array $pivots = [];
22
    /** @var AttributeModel[] */
23
    private array $attributes = [];
24
    /** @var ValueBase[] */
25
    private array $values = [];
26
27 1
    public function setEntityKey(int $entityKey): void
28
    {
29 1
        $this->entityKey = $entityKey;
30
    }
31
32 1
    public function getEntityKey(): int
33
    {
34 1
        return $this->entityKey;
35
    }
36
37 1
    public function addAttribute(AttributeModel $attributeModel): void
38
    {
39 1
        $this->attributes[$attributeModel->getName()] = $attributeModel;
40
    }
41
42 1
    public function getAttributes(): array
43
    {
44 1
        return $this->attributes;
45
    }
46
47 1
    public function addValue(string $attrName, ValueBase $valueModel): void
48
    {
49 1
        $this->values[$attrName] = $valueModel;
50
    }
51
52 1
    public function getValues(): array
53
    {
54 1
        return $this->values;
55
    }
56
57 1
    public function addPivot(string $attrName, PivotModel $pivot): void
58
    {
59 1
        $this->pivots[$attrName] = $pivot;
60
    }
61
62 1
    public function getPivots() : array
63
    {
64 1
        return $this->pivots;
65
    }
66
}