Completed
Push — master ( a4e176...8c9478 )
by Adam
02:50
created

Csv::toArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace BestServedCold\PhalueObjects\Format;
4
5
use BestServedCold\PhalueObjects\Contract\Arrayable;
6
use BestServedCold\PhalueObjects\ValueObject;
7
8
/**
9
 * Class Csv
10
 *
11
 * @package BestServedCold\PhalueObjects\Format
12
 */
13
class Csv extends ValueObject implements Arrayable
14
{
15
    /**
16
     * @param  array       $array
17
     * @param  string|null $space
18
     * @return static
19
     */
20 12
    public static function fromArray(array $array, $space = null)
21
    {
22 12
        return new static(implode(',' . $space, $array));
23
    }
24
25
    /**
26
     * @return array
27
     */
28
    public function toArray()
29
    {
30
        return explode(',', $this->getValue());
31
    }
32
}
33