Passed
Push — master ( e1d378...f1a11e )
by Vitaliy
11:08 queued 21s
created

ActionCollection::valid()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types = 1);
4
5
/*
6
 * This file is part of the FiveLab Resource package
7
 *
8
 * (c) FiveLab
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 FiveLab\Component\Resource\Resource\Action;
15
16
/**
17
 * The collection for store resource actions.
18
 *
19
 * @author Vitaliy Zhuk <[email protected]>
20
 */
21
class ActionCollection implements \IteratorAggregate, \Countable
22
{
23
    /**
24
     * @var array
25
     */
26
    private $actions;
27
28
    /**
29
     * Constructor.
30
     *
31
     * @param ActionInterface ...$actions
32
     */
33 9
    public function __construct(ActionInterface ...$actions)
34
    {
35 9
        $this->actions = $actions;
36 9
    }
37
38
    /**
39
     * {@inheritdoc}
40
     *
41
     * @return \ArrayIterator|ActionInterface[]
42
     */
43 2
    public function getIterator(): \ArrayIterator
44
    {
45 2
        return new \ArrayIterator($this->actions);
46
    }
47
48
    /**
49
     * {@inheritdoc}
50
     */
51 7
    public function count(): int
52
    {
53 7
        return \count($this->actions);
54
    }
55
}
56