Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
14 / 14
100.00% covered (success)
100.00%
8 / 8
CRAP
100.00% covered (success)
100.00%
1 / 1
AbstractType
100.00% covered (success)
100.00%
14 / 14
100.00% covered (success)
100.00%
8 / 8
9
100.00% covered (success)
100.00%
1 / 1
 hasAxisX
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 hasAxisY
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getHashIndex
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setHashIndex
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 addSeries
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getSeries
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setSeries
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 __clone
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
2
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 * @see        https://github.com/PHPOffice/PHPPresentation
14 *
15 * @license     http://www.gnu.org/licenses/lgpl.txt LGPL version 3
16 */
17
18declare(strict_types=1);
19
20namespace PhpOffice\PhpPresentation\Shape\Chart\Type;
21
22use PhpOffice\PhpPresentation\ComparableInterface;
23use PhpOffice\PhpPresentation\Shape\Chart\Series;
24
25/**
26 * \PhpOffice\PhpPresentation\Shape\Chart\Type.
27 */
28abstract class AbstractType implements ComparableInterface
29{
30    /**
31     * Has Axis X?
32     *
33     * @var bool
34     */
35    protected $hasAxisX = true;
36
37    /**
38     * Has Axis Y?
39     *
40     * @var bool
41     */
42    protected $hasAxisY = true;
43
44    /**
45     * Hash index.
46     *
47     * @var int
48     */
49    private $hashIndex;
50
51    /**
52     * @var array<int, Series>
53     */
54    private $series = [];
55
56    /**
57     * Has Axis X?
58     */
59    public function hasAxisX(): bool
60    {
61        return $this->hasAxisX;
62    }
63
64    /**
65     * Has Axis Y?
66     */
67    public function hasAxisY(): bool
68    {
69        return $this->hasAxisY;
70    }
71
72    /**
73     * Get hash index.
74     *
75     * Note that this index may vary during script execution! Only reliable moment is
76     * while doing a write of a workbook and when changes are not allowed.
77     *
78     * @return null|int Hash index
79     */
80    public function getHashIndex(): ?int
81    {
82        return $this->hashIndex;
83    }
84
85    /**
86     * Set hash index.
87     *
88     * Note that this index may vary during script execution! Only reliable moment is
89     * while doing a write of a workbook and when changes are not allowed.
90     *
91     * @param int $value Hash index
92     *
93     * @return AbstractType
94     */
95    public function setHashIndex(int $value)
96    {
97        $this->hashIndex = $value;
98
99        return $this;
100    }
101
102    /**
103     * Add Series.
104     *
105     * @return $this
106     */
107    public function addSeries(Series $value)
108    {
109        $this->series[] = $value;
110
111        return $this;
112    }
113
114    /**
115     * Get Series.
116     *
117     * @return array<int, Series>
118     */
119    public function getSeries(): array
120    {
121        return $this->series;
122    }
123
124    /**
125     * Set Series.
126     *
127     * @param array<int, Series> $series
128     *
129     * @return $this
130     */
131    public function setSeries(array $series = [])
132    {
133        $this->series = $series;
134
135        return $this;
136    }
137
138    /**
139     * @see http://php.net/manual/en/language.oop5.cloning.php
140     */
141    public function __clone()
142    {
143        $arrayClone = [];
144        foreach ($this->series as $itemSeries) {
145            $arrayClone[] = clone $itemSeries;
146        }
147        $this->series = $arrayClone;
148    }
149}