ColumnExpression   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 56
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A setExpressions() 0 4 1
A toArray() 0 7 2
A getExpressions() 0 3 1
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 implements Column
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->setExpressions(func_get_args());
31 1
    }
32
33
    /**
34
     * Sets collection of expressions.
35
     * Returns the current object.
36
     *
37
     * @param array     $expressions    Collection of expressions.
38
     *
39
     * @return self
40
     */
41 1
    private function setExpressions(array $expressions)
42
    {
43 1
        $this->expressions = $expressions;
44 1
        return $this;
45
    }
46
47
    /**
48
     * Gets collection of expressions.
49
     *
50
     * @return Expression[]
51
     */
52 1
    private function getExpressions()
53
    {
54 1
        return $this->expressions;
55
    }
56
57
    /**
58
     * Returns data as an associative array.
59
     *
60
     * @return array
61
     */
62 1
    public function toArray()
63
    {
64 1
        $expressions = [];
65 1
        foreach ($this->getExpressions() as $expression) {
66 1
            $expressions[$expression->getKeyName()] = $expression->getValue();
67
        }
68 1
        return $expressions;
69
    }
70
}
71