ResourcesCollection   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 45
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A unserialize() 0 3 1
A serialize() 0 3 1
A all() 0 3 1
A count() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the ekino Drupal Debug project.
7
 *
8
 * (c) ekino
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Ekino\Drupal\Debug\Resource\Model;
15
16
use Symfony\Component\Config\Resource\SelfCheckingResourceInterface;
17
18
class ResourcesCollection implements \Countable, \Serializable
19
{
20
    /**
21
     * @var SelfCheckingResourceInterface[]
22
     */
23
    private $resources;
24
25
    /**
26
     * @param SelfCheckingResourceInterface[] $resources
27
     */
28 72
    public function __construct(array $resources = array())
29
    {
30 72
        $this->resources = $resources;
31 72
    }
32
33
    /**
34
     * @return SelfCheckingResourceInterface[]
35
     */
36 50
    public function all(): array
37
    {
38 50
        return $this->resources;
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44 43
    public function count(): int
45
    {
46 43
        return \count($this->resources);
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52 38
    public function serialize(): ?string
53
    {
54 38
        return \serialize($this->resources);
55
    }
56
57
    /**
58
     * {@inheritdoc}
59
     */
60 46
    public function unserialize($serialized): void
61
    {
62 46
        $this->resources = \unserialize($serialized);
63 46
    }
64
}
65