ResourcesCollection::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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