Completed
Push — master ( 50437b...6d2b5a )
by Adam
02:31
created

Csv   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
dl 0
loc 27
c 0
b 0
f 0
wmc 3
lcom 0
cbo 2
ccs 4
cts 6
cp 0.6667
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A fromArray() 0 4 1
A fromMultiArray() 0 4 1
A toArray() 0 4 1
1
<?php
2
3
namespace BestServedCold\PhalueObjects\Format;
4
5
use BestServedCold\PhalueObjects\Contract\VOArrayable;
6
use BestServedCold\PhalueObjects\VOString;
7
use BestServedCold\PhalueObjects\VOArray\Mixin as VOArrayMixin;
8
9
/**
10
 * Class Csv
11
 *
12
 * @package BestServedCold\PhalueObjects\Format
13
 */
14
class Csv extends VOString implements VOArrayable
15
{
16
    use VOArrayMixin;
17
18
    /**
19
     * @param  array       $array
20
     * @param  string|null $space
21
     * @return static
22
     */
23 16
    public static function fromArray(array $array, $space = null)
24
    {
25 16
        return new static(implode(',' . $space, $array));
26
    }
27
28
    private static function fromMultiArray(array $array, $space = null)
0 ignored issues
show
Unused Code introduced by
This method is not used, and could be removed.
Loading history...
Unused Code introduced by
The parameter $array is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $space is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
29
    {
30
31
    }
32
33
    /**
34
     * @return array
35
     */
36 2
    public function toArray()
37
    {
38 2
        return explode(',', $this->getValue());
39
    }
40
}
41