Completed
Push — master ( d75c1f...eed677 )
by Viacheslav
12s
created

ArrayOf::getType()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Swaggest\PhpCodeBuilder\Types;
4
5
6
use Swaggest\PhpCodeBuilder\PhpAnyType;
7
8
class ArrayOf implements PhpAnyType
9
{
10
    /** @var PhpAnyType */
11
    private $type;
12
13
    /**
14
     * @return PhpAnyType
15
     */
16
    public function getType()
17
    {
18
        return $this->type;
19
    }
20
21
    /**
22
     * ArrayOf constructor.
23
     * @param PhpAnyType $type
24
     */
25 2
    public function __construct(PhpAnyType $type)
26
    {
27 2
        $this->type = $type;
28 2
    }
29
30
    /**
31
     * @return string
32
     */
33 2
    public function renderArgumentType()
34
    {
35 2
        return '';
36
    }
37
38
    /**
39
     * @return string
40
     */
41 2
    public function renderPhpDocType()
42
    {
43 2
        if ($this->type instanceof OrType) {
44 2
            return $this->type->renderArrayPhpDocType();
45
        } else {
46 2
            return $this->type->renderPhpDocType() . '[]';
47
        }
48
    }
49
50
51
}