Passed
Push — master ( c74e22...4ec3b5 )
by Володимир
04:11
created

EntityList::getList()   A

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
 * 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 string[]
19
     */
20
    private $entityTypes = [];
21
22
23
    /**
24
     * EntityList constructor.
25
     *
26
     * @param string[] $entityTypes
27
     */
28
    public function __construct(
29
        $entityTypes = []
30
    ) {
31
        $this->entityTypes = $entityTypes;
32
    }
33
34
    /**
35
     * Retrieve list of entities
36
     *
37
     * @return ValidatorInterface[]
38
     */
39
    public function getList(): array
40
    {
41
        return $this->entityTypes;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->entityTypes returns the type string[] which is incompatible with the documented return type Hryvinskyi\DeferJs\Model...or\ValidatorInterface[].
Loading history...
42
    }
43
44
    /**
45
     * @param string $code
46
     *
47
     * @return ValidatorInterface
48
     */
49
    public function getEntityByCode(string $code): ValidatorInterface
50
    {
51
        return $this->entityTypes[$code];
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->entityTypes[$code] returns the type string which is incompatible with the type-hinted return Hryvinskyi\DeferJs\Model...ator\ValidatorInterface.
Loading history...
52
    }
53
}