Completed
Push — master ( 58a355...7779cf )
by Mike
02:36
created

Format::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace phpDocumentor\Guides\RestructuredText\Formats;
6
7
use IteratorAggregate;
8
use phpDocumentor\Guides\Formats\Format as BaseFormat;
9
use phpDocumentor\Guides\RestructuredText\Directives\Directive;
10
use function iterator_to_array;
11
12
abstract class Format implements BaseFormat
13
{
14
    /** @var string */
15
    private $fileExtension;
16
17
    /** @var IteratorAggregate<Directive> */
18
    private $directives;
19
20
    /**
21
     * @param IteratorAggregate<Directive> $directives
0 ignored issues
show
Documentation introduced by
The doc-type IteratorAggregate<Directive> could not be parsed: Expected "|" or "end of type", but got "<" at position 17. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
22
     */
23
    public function __construct(string $fileExtension, IteratorAggregate $directives)
24
    {
25
        $this->fileExtension = $fileExtension;
26
        $this->directives = $directives;
27
    }
28
29
    public function getFileExtension() : string
30
    {
31
        return $this->fileExtension;
32
    }
33
34
    /**
35
     * @return array<Directive>
36
     */
37
    public function getDirectives() : array
38
    {
39
        return iterator_to_array($this->directives);
40
    }
41
}
42