Completed
Push — master ( ee3f46...2dd99c )
by Markus
03:13
created

ArrayValue   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 66.67%

Importance

Changes 4
Bugs 0 Features 1
Metric Value
wmc 3
c 4
b 0
f 1
lcom 1
cbo 1
dl 0
loc 28
ccs 6
cts 9
cp 0.6667
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A setValues() 0 6 1
A getEscapedValue() 0 6 1
1
<?php
2
3
/*
4
 * This file is part of the eluceo/iCal package.
5
 *
6
 * (c) Markus Poerschke <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Eluceo\iCal\Property;
13
14
use Eluceo\iCal\Util\PropertyValueUtil;
15
16
class ArrayValue implements ValueInterface
17
{
18
    /**
19
     * The value.
20
     *
21
     * @var array
22
     */
23
    protected $values;
24
25 4
    public function __construct(array $values)
26
    {
27 4
        $this->values = $values;
28 4
    }
29
30
    public function setValues(array $values)
31
    {
32
        $this->values = $values;
33
34
        return $this;
35
    }
36
37
    public function getEscapedValue()
38
    {
39 4
        return implode(',', array_map(function ($value) {
40 3
            return PropertyValueUtil::escapeValue((string) $value);
41 4
        }, $this->values));
42
    }
43
}
44