Questions::count()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
1
<?php declare(strict_types=1);
2
3
namespace VSV\GVQ_API\Question\Models;
4
5
class Questions implements \IteratorAggregate, \Countable
6
{
7
    /**
8
     * @var Question[]
9
     */
10
    private $questions;
11
12
    /**
13
     * Questions constructor.
14
     * @param Question ...$questions
15
     */
16
    public function __construct(Question ...$questions)
17
    {
18
        $this->questions = $questions;
19
    }
20
21
    /**
22
     * @inheritdoc
23
     */
24
    public function getIterator(): \ArrayIterator
25
    {
26
        return new \ArrayIterator($this->questions);
27
    }
28
29
    /**
30
     * @inheritdoc
31
     */
32
    public function count(): int
33
    {
34
        return count($this->questions);
35
    }
36
37
    /**
38
     * @return Question[]
39
     */
40
    public function toArray(): array
41
    {
42
        return $this->questions;
43
    }
44
}
45