GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

ListField::setData()   A
last analyzed

Complexity

Conditions 4
Paths 3

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 4

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 7
cts 7
cp 1
rs 9.2
c 0
b 0
f 0
cc 4
eloc 7
nc 3
nop 1
crap 4
1
<?php
2
namespace Solvire\API\Serializers\DataFields;
3
4
/**
5
 *
6
 * @author solvire <[email protected]>
7
 * @package DataFields
8
 * @namespace Solvire\API\Serializers\DataFields
9
 */
10
class ListField extends DataField
11
{
12
13
    protected $delimiter = ',';
14
15 1
    public function setData($data)
16
    {
17 1
        if (! is_string($data) && ! is_array($data))
18 1
            throw new \RuntimeException('ListField data must be a string CSV or other delimited list: in ' . $this->name );
19
        
20 1
        if (is_string($data))
21 1
            $data = explode($this->delimiter, $data);
22
        
23 1
        $this->data = $data;
24 1
        return $this;
25
    }
26
27
    /**
28
     * TODO fix the list implosion thing here
29
     * This is a list (array)
30
     */
31 1
    public function getData()
32
    {
33 1
        return $this->data;
34
    }
35
36
    /**
37
     *
38
     * @param string $delimiter            
39
     * @return \Solvire\API\Serializers\DataFields\ListField
40
     */
41 1
    public function setDelimiter($delimiter)
42
    {
43 1
        $this->delimiter = $delimiter;
44 1
        return $this;
45
    }
46
47
    /**
48
     *
49
     * @return string
50
     */
51 1
    public function getDelimiter()
52
    {
53 1
        return $this->delimiter;
54
    }
55
}
56