Completed
Pull Request — develop (#190)
by Franck
08:16
created

AbstractType::hasAxisX()   A

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 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * This file is part of PHPPresentation - A pure PHP library for reading and writing
4
 * presentations documents.
5
 *
6
 * PHPPresentation is free software distributed under the terms of the GNU Lesser
7
 * General Public License version 3 as published by the Free Software Foundation.
8
 *
9
 * For the full copyright and license information, please read the LICENSE
10
 * file that was distributed with this source code. For the full list of
11
 * contributors, visit https://github.com/PHPOffice/PHPPresentation/contributors.
12
 *
13
 * @link        https://github.com/PHPOffice/PHPPresentation
14
 * @copyright   2009-2015 PHPPresentation contributors
15
 * @license     http://www.gnu.org/licenses/lgpl.txt LGPL version 3
16
 */
17
18
namespace PhpOffice\PhpPresentation\Shape\Chart\Type;
19
20
use PhpOffice\PhpPresentation\ComparableInterface;
21
use PhpOffice\PhpPresentation\Shape\Chart\Series;
22
23
/**
24
 * \PhpOffice\PhpPresentation\Shape\Chart\Type
25
 */
26
abstract class AbstractType implements ComparableInterface
27
{
28
    /**
29
     * Has Axis X?
30
     *
31
     * @var boolean
32
     */
33
    protected $hasAxisX = true;
34
35
    /**
36
     * Has Axis Y?
37
     *
38
     * @var boolean
39
     */
40
    protected $hasAxisY = true;
41
42
    /**
43
     * Hash index
44
     *
45
     * @var string
46
     */
47
    private $hashIndex;
48
    
49
    /**
50
     * Data
51
     *
52
     * @var array
53
     */
54
    private $data = array();
55
56
    /**
57
     * Has Axis X?
58
     *
59
     * @return boolean
60
     */
61 24
    public function hasAxisX()
62
    {
63 24
        return $this->hasAxisX;
64
    }
65
66
    /**
67
     * Has Axis Y?
68
     *
69
     * @return boolean
70
     */
71 24
    public function hasAxisY()
72
    {
73 24
        return $this->hasAxisY;
74
    }
75
76
    /**
77
     * Get hash index
78
     *
79
     * Note that this index may vary during script execution! Only reliable moment is
80
     * while doing a write of a workbook and when changes are not allowed.
81
     *
82
     * @return string Hash index
83
     */
84 1
    public function getHashIndex()
85
    {
86 1
        return $this->hashIndex;
87
    }
88
89
    /**
90
     * Set hash index
91
     *
92
     * Note that this index may vary during script execution! Only reliable moment is
93
     * while doing a write of a workbook and when changes are not allowed.
94
     *
95
     * @param string $value Hash index
96
     */
97 1
    public function setHashIndex($value)
98
    {
99 1
        $this->hashIndex = $value;
100 1
        return $this;
101
    }
102
103
    /**
104
     * Add Series
105
     *
106
     * @param  \PhpOffice\PhpPresentation\Shape\Chart\Series $value
107
     * @return self
108
     */
109 52
    public function addSeries(Series $value)
110
    {
111 52
        $this->data[] = $value;
112 52
        return $this;
113
    }
114
115
    /**
116
     * Get Series
117
     *
118
     * @return \PhpOffice\PhpPresentation\Shape\Chart\Series[]
119
     */
120 62
    public function getSeries()
121
    {
122 62
        return $this->data;
123
    }
124
125
    /**
126
     * Set Series
127
     *
128
     * @param  array $value Array of \PhpOffice\PhpPresentation\Shape\Chart\Series
129
     * @return self
130
     */
131 15
    public function setSeries($value = array())
132
    {
133 15
        $this->data = $value;
134 15
        return $this;
135
    }
136
137
    /**
138
     * Get Data
139
     *
140
     * @deprecated getSeries
141
     */
142 18
    public function getData()
143
    {
144 18
        return $this->getSeries();
145
    }
146
147
    /**
148
     * Set Data
149
     *
150
     * @deprecated setSeries
151
     */
152
    public function setData($value = array())
153
    {
154
        return $this->setSeries($value);
155
    }
156
157
    /**
158
     * @return mixed
159
     * @link http://php.net/manual/en/language.oop5.cloning.php
160
     */
161
    function __clone()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Comprehensibility Best Practice introduced by
It is recommend to declare an explicit visibility for __clone.

Generally, we recommend to declare visibility for all methods in your source code. This has the advantage of clearly communication to other developers, and also yourself, how this method should be consumed.

If you are not sure which visibility to choose, it is a good idea to start with the most restrictive visibility, and then raise visibility as needed, i.e. start with private, and only raise it to protected if a sub-class needs to have access, or public if an external class needs access.

Loading history...
162
    {
163
        $arrayClone = array();
164
        foreach ($this->data as $itemSeries) {
165
            $arrayClone[] = clone $itemSeries;
166
        }
167
        $this->data = $arrayClone;
168
    }
169
170
}
171