Completed
Push — master ( 5db245...cdc2ed )
by Markus
17s queued 14s
created

ArrayValue   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

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
class ArrayValue implements ValueInterface
15
{
16
    /**
17
     * The value.
18
     *
19
     * @var array
20
     */
21
    protected $values;
22
23 11
    public function __construct(array $values)
24
    {
25 11
        $this->values = $values;
26 11
    }
27
28 4
    public function setValues(array $values)
29
    {
30 4
        $this->values = $values;
31
32 4
        return $this;
33
    }
34
35
    public function getEscapedValue(): string
36
    {
37 9
        return implode(',', array_map(function (string $value): string {
38 7
            return (new StringValue($value))->getEscapedValue();
39 9
        }, $this->values));
40
    }
41
}
42