Passed
Push — master ( 9afe80...f5220c )
by Gabriel
03:51
created

EntrypointsCollection   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 32
rs 10
c 0
b 0
f 0
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A has() 0 3 1
A get() 0 7 2
A __construct() 0 3 1
1
<?php
2
3
namespace ByTIC\Assets\Encore;
4
5
use Psr\Container\ContainerInterface;
6
use Symfony\WebpackEncoreBundle\Asset\EntrypointLookupInterface;
7
8
/**
9
 * Class EntrypointsCollection
10
 * @package ByTIC\Assets\Encore
11
 */
12
class EntrypointsCollection implements ContainerInterface
13
{
14
    protected $entries = [];
15
16
    /**
17
     * EntrypointsCollection constructor.
18
     * @param array $entries
19
     */
20
    public function __construct($entries = null)
21
    {
22
        $this->entries = $entries;
23
    }
24
25
    /**
26
     * @inheritDoc
27
     * @return EntrypointLookupInterface
28
     */
29
    public function get($id)
30
    {
31
        if (!$this->has($id)) {
32
            return null;
33
        }
34
35
        return $this->entries[$id];
36
    }
37
38
    /**
39
     * @inheritDoc
40
     */
41
    public function has($id)
42
    {
43
        return isset($this->entries[$id]);
44
    }
45
}
46