EntityList::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
/**
3
 * Copyright (c) 2019. Volodymyr Hryvinskyi.  All rights reserved.
4
 * @author: <mailto:[email protected]>
5
 * @github: <https://github.com/hryvinskyi>
6
 */
7
8
declare(strict_types=1);
9
10
namespace Hryvinskyi\DeferJs\Model\PassesValidator;
11
12
/**
13
 * Class EntityList
14
 */
15
class EntityList
16
{
17
    /**
18
     * @var ValidatorInterface[]
19
     */
20
    private $entityTypes = [];
21
22
    /**
23
     * EntityList constructor.
24
     *
25
     * @param ValidatorInterface[] $entityTypes
26
     */
27
    public function __construct(
28
        $entityTypes = []
29
    ) {
30
        $this->entityTypes = $entityTypes;
31
    }
32
33
    /**
34
     * Retrieve list of entities
35
     *
36
     * @return ValidatorInterface[]
37
     */
38
    public function getList(): array
39
    {
40
        return $this->entityTypes;
41
    }
42
43
    /**
44
     * @param string $code
45
     *
46
     * @return ValidatorInterface
47
     */
48
    public function getEntityByCode(string $code): ValidatorInterface
49
    {
50
        return $this->entityTypes[$code];
51
    }
52
}