Passed
Push — master ( 9c8d3b...04f5d8 )
by Oss
01:40
created

ColumnExpression::toArray()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 7
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 2
1
<?php
2
/**
3
 * @category    Brownie/BpmOnline
4
 * @author      Brownie <[email protected]>
5
 * @license     https://opensource.org/licenses/MIT
6
 */
7
8
namespace Brownie\BpmOnline\DataService\Column;
9
10
/**
11
 * An expression defining a column type.
12
 */
13
class ColumnExpression
14
{
15
16
    /**
17
     * Collection of expressions.
18
     *
19
     * @var Expression[]
20
     */
21
    private $expressions = [];
22
23
    /**
24
     * Sets the input values.
25
     *
26
     * @param Expression|null   $_      Collection of expressions.
27
     */
28 1
    public function __construct(Expression $_ = null)
29
    {
30 1
        $this->expressions = func_get_args();
31 1
    }
32
33
    /**
34
     * Returns data as an associative array.
35
     *
36
     * @return array
37
     */
38 1
    public function toArray()
39
    {
40 1
        $expressions = [];
41 1
        foreach ($this->expressions as $expression) {
42 1
            $expressions[$expression->getKeyName()] = $expression->getValue();
43
        }
44 1
        return $expressions;
45
    }
46
}
47