Passed
Push — master ( b099f7...1e60c5 )
by Valentin
05:38 queued 01:16
created

Split::convertCurrent()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 1
eloc 1
c 1
b 1
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Spiral\DataGrid\Specification\Value\Accessor;
6
7
use Spiral\DataGrid\Specification\ValueInterface;
8
9
class Split extends Accessor
10
{
11
    /** @var string */
12
    private $char;
13
14
    public function __construct(ValueInterface $next, string $char = ',')
15
    {
16
        parent::__construct($next);
17
        $this->char = $char;
18
    }
19
20
    protected function acceptsCurrent($value): bool
21
    {
22
        return is_string($value);
23
    }
24
25
    protected function convertCurrent($value)
26
    {
27
        return explode($this->char, $value);
28
    }
29
}
30