Test Failed
Push — master ( d818fc...2d2f9a )
by Christophe
08:50
created

Data::draw()   C

Complexity

Conditions 8
Paths 23

Size

Total Lines 43
Code Lines 27

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 27
CRAP Score 8.1373

Importance

Changes 0
Metric Value
dl 0
loc 43
ccs 27
cts 31
cp 0.871
rs 5.3846
c 0
b 0
f 0
cc 8
eloc 27
nc 23
nop 1
crap 8.1373

1 Method

Rating   Name   Duplication   Size   Complexity  
A Data::isFirstRowIsData() 0 4 1
1
<?php
2
3
namespace CMEN\GoogleChartsBundle\GoogleCharts;
4
5
/**
6
 * @author Christophe Meneses
7
 */
8
class Data
9
{
10
    /**
11
     * @var array
12
     */
13
    private $arrayToDataTable;
14
15
    /**
16
     * @var bool
17
     */
18
    private $firstRowIsData;
19
20
    /**
21
     * Data constructor.
22
     */
23
    public function __construct()
24
    {
25
        $this->arrayToDataTable = [];
26
        $this->firstRowIsData = false;
27
    }
28
29
    /**
30
     * @return array
31
     */
32
    public function getArrayToDataTable()
33
    {
34
        return $this->arrayToDataTable;
35
    }
36
37
    /**
38
     * This method takes in a two-dimensional array. The data types of each column are interpreted automatically from
39
     * the data given. If a cell has no value, specify a null or empty value as appropriate. Column data types can also
40
     * be specified using the object literal notation in the first row (the column header row) of the array
41
     * (i.e. ['label' => 'Start Date', 'type' => 'date']). Optional data roles may be used as well, but they must be
42 2
     * defined explicitly using object literal notation. Object literal notation may also be used for any cell,
43
     * allowing you to define Cell Objects).
44 2
     *
45 2
     * @param array $arrayToDataTable a two-dimensional array, where each row represents a row in the data table
46 2
     * @param bool  $firstRowIsData   if firstRowIsData is false (the default), the first row will be interpreted
47
     *                                as header labels
48
     */
49
    public function setArrayToDataTable($arrayToDataTable, $firstRowIsData = false)
50
    {
51
        $this->arrayToDataTable = $arrayToDataTable;
52
        $this->firstRowIsData = $firstRowIsData;
53
    }
54
55
    /**
56
     * @return bool
57 2
     */
58
    public function isFirstRowIsData()
59 2
    {
60 1
        return $this->firstRowIsData;
61
    }
62
}
63