Passed
Push — feature/VSVGVQ-7 ( 2ea183...38d699 )
by Luc
03:04
created

Answers   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 37
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getIterator() 0 3 1
A __construct() 0 3 1
A count() 0 3 1
A toArray() 0 3 1
1
<?php declare(strict_types=1);
2
3
namespace VSV\GVQ_API\Question\Models;
4
5
class Answers implements \IteratorAggregate, \Countable
6
{
7
    /**
8
     * @var Answer[]
9
     */
10
    private $answers;
11
12
    /**
13
     * @param Answer ...$answers
14
     */
15
    public function __construct(Answer ...$answers)
16
    {
17
        $this->answers = $answers;
18
    }
19
20
    /**
21
     * @inheritdoc
22
     */
23
    public function getIterator(): \ArrayIterator
24
    {
25
        return new \ArrayIterator($this->answers);
26
    }
27
28
    /**
29
     * @inheritdoc
30
     */
31
    public function count(): int
32
    {
33
        return count($this->answers);
34
    }
35
36
    /**
37
     * @return Answer[]
38
     */
39
    public function toArray(): array
40
    {
41
        return $this->answers;
42
    }
43
}
44