EntityList   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 5
c 2
b 0
f 0
dl 0
loc 36
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getEntityByCode() 0 3 1
A __construct() 0 4 1
A getList() 0 3 1
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
}