Test Failed
Push — master ( ecd78b...d05c81 )
by Kirill
02:43
created

ListValue   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 34
rs 10
c 0
b 0
f 0
wmc 4
lcom 0
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A toString() 0 10 2
A getValue() 0 4 1
1
<?php
2
/**
3
 * This file is part of Railt package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
declare(strict_types=1);
9
10
namespace Railt\SDL\Frontend\IR\Value;
11
12
/**
13
 * Class ListValue
14
 */
15
class ListValue extends AbstractValue
16
{
17
    /**
18
     * ConstantValue constructor.
19
     * @param array|ValueInterface[] $values
20
     * @param int $offset
21
     */
22
    public function __construct(array $values, int $offset = 0)
23
    {
24
        parent::__construct($values, $offset);
25
    }
26
27
    /**
28
     * @return string
29
     */
30
    public function toString(): string
31
    {
32
        $result = [];
33
34
        foreach ($this->getValue() as $value) {
35
            $result[] = $value->toString();
36
        }
37
38
        return \sprintf('[%s]', \implode(', ', $result));
39
    }
40
41
    /**
42
     * @return array|ValueInterface[]|AbstractValue[]
43
     */
44
    public function getValue(): array
45
    {
46
        return parent::getValue();
47
    }
48
}
49