Notation::fromArray()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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