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

ArrayOf   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 81.82%

Importance

Changes 0
Metric Value
dl 0
loc 39
ccs 9
cts 11
cp 0.8182
rs 10
c 0
b 0
f 0
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A renderPhpDocType() 0 6 2
A getType() 0 3 1
A __construct() 0 3 1
A renderArgumentType() 0 3 1
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
}