Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
37 / 37
100.00% covered (success)
100.00%
16 / 16
CRAP
100.00% covered (success)
100.00%
1 / 1
Bullet
100.00% covered (success)
100.00%
37 / 37
100.00% covered (success)
100.00%
16 / 16
17
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
1
 getBulletType
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setBulletType
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getBulletFont
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setBulletFont
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
2
 getBulletChar
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setBulletChar
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getBulletNumericStyle
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setBulletNumericStyle
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getBulletNumericStartAt
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setBulletNumericStartAt
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getHashCode
100.00% covered (success)
100.00%
8 / 8
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
 getBulletColor
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setBulletColor
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
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 * @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\Style;
21
22use PhpOffice\PhpPresentation\ComparableInterface;
23
24/**
25 * \PhpOffice\PhpPresentation\Style\Bullet.
26 */
27class Bullet implements ComparableInterface
28{
29    // Bullet types
30    public const TYPE_NONE = 'none';
31    public const TYPE_BULLET = 'bullet';
32    public const TYPE_NUMERIC = 'numeric';
33
34    // Numeric bullet styles
35    public const NUMERIC_DEFAULT = 'arabicPeriod';
36    public const NUMERIC_ALPHALCPARENBOTH = 'alphaLcParenBoth';
37    public const NUMERIC_ALPHAUCPARENBOTH = 'alphaUcParenBoth';
38    public const NUMERIC_ALPHALCPARENR = 'alphaLcParenR';
39    public const NUMERIC_ALPHAUCPARENR = 'alphaUcParenR';
40    public const NUMERIC_ALPHALCPERIOD = 'alphaLcPeriod';
41    public const NUMERIC_ALPHAUCPERIOD = 'alphaUcPeriod';
42    public const NUMERIC_ARABICPARENBOTH = 'arabicParenBoth';
43    public const NUMERIC_ARABICPARENR = 'arabicParenR';
44    public const NUMERIC_ARABICPERIOD = 'arabicPeriod';
45    public const NUMERIC_ARABICPLAIN = 'arabicPlain';
46    public const NUMERIC_ROMANLCPARENBOTH = 'romanLcParenBoth';
47    public const NUMERIC_ROMANUCPARENBOTH = 'romanUcParenBoth';
48    public const NUMERIC_ROMANLCPARENR = 'romanLcParenR';
49    public const NUMERIC_ROMANUCPARENR = 'romanUcParenR';
50    public const NUMERIC_ROMANLCPERIOD = 'romanLcPeriod';
51    public const NUMERIC_ROMANUCPERIOD = 'romanUcPeriod';
52    public const NUMERIC_CIRCLENUMDBPLAIN = 'circleNumDbPlain';
53    public const NUMERIC_CIRCLENUMWDBLACKPLAIN = 'circleNumWdBlackPlain';
54    public const NUMERIC_CIRCLENUMWDWHITEPLAIN = 'circleNumWdWhitePlain';
55    public const NUMERIC_ARABICDBPERIOD = 'arabicDbPeriod';
56    public const NUMERIC_ARABICDBPLAIN = 'arabicDbPlain';
57    public const NUMERIC_EA1CHSPERIOD = 'ea1ChsPeriod';
58    public const NUMERIC_EA1CHSPLAIN = 'ea1ChsPlain';
59    public const NUMERIC_EA1CHTPERIOD = 'ea1ChtPeriod';
60    public const NUMERIC_EA1CHTPLAIN = 'ea1ChtPlain';
61    public const NUMERIC_EA1JPNCHSDBPERIOD = 'ea1JpnChsDbPeriod';
62    public const NUMERIC_EA1JPNKORPLAIN = 'ea1JpnKorPlain';
63    public const NUMERIC_EA1JPNKORPERIOD = 'ea1JpnKorPeriod';
64    public const NUMERIC_ARABIC1MINUS = 'arabic1Minus';
65    public const NUMERIC_ARABIC2MINUS = 'arabic2Minus';
66    public const NUMERIC_HEBREW2MINUS = 'hebrew2Minus';
67    public const NUMERIC_THAIALPHAPERIOD = 'thaiAlphaPeriod';
68    public const NUMERIC_THAIALPHAPARENR = 'thaiAlphaParenR';
69    public const NUMERIC_THAIALPHAPARENBOTH = 'thaiAlphaParenBoth';
70    public const NUMERIC_THAINUMPERIOD = 'thaiNumPeriod';
71    public const NUMERIC_THAINUMPARENR = 'thaiNumParenR';
72    public const NUMERIC_THAINUMPARENBOTH = 'thaiNumParenBoth';
73    public const NUMERIC_HINDIALPHAPERIOD = 'hindiAlphaPeriod';
74    public const NUMERIC_HINDINUMPERIOD = 'hindiNumPeriod';
75    public const NUMERIC_HINDINUMPARENR = 'hindiNumParenR';
76    public const NUMERIC_HINDIALPHA1PERIOD = 'hindiAlpha1Period';
77
78    /**
79     * Bullet type.
80     *
81     * @var string
82     */
83    private $bulletType = self::TYPE_NONE;
84
85    /**
86     * Bullet font.
87     *
88     * @var string
89     */
90    private $bulletFont;
91
92    /**
93     * Bullet char.
94     *
95     * @var string
96     */
97    private $bulletChar = '-';
98
99    /**
100     * Bullet char.
101     *
102     * @var Color
103     */
104    private $bulletColor;
105
106    /**
107     * Bullet numeric style.
108     *
109     * @var string
110     */
111    private $bulletNumericStyle = self::NUMERIC_DEFAULT;
112
113    /**
114     * Bullet numeric start at.
115     *
116     * @var int|string
117     */
118    private $bulletNumericStartAt;
119
120    /**
121     * Hash index.
122     *
123     * @var int
124     */
125    private $hashIndex;
126
127    public function __construct()
128    {
129        $this->bulletType = self::TYPE_NONE;
130        $this->bulletFont = 'Calibri';
131        $this->bulletChar = '-';
132        $this->bulletColor = new Color();
133        $this->bulletNumericStyle = self::NUMERIC_DEFAULT;
134        $this->bulletNumericStartAt = 1;
135    }
136
137    /**
138     * Get bullet type.
139     *
140     * @return string
141     */
142    public function getBulletType()
143    {
144        return $this->bulletType;
145    }
146
147    /**
148     * Set bullet type.
149     *
150     * @param string $pValue
151     *
152     * @return Bullet
153     */
154    public function setBulletType($pValue = self::TYPE_NONE)
155    {
156        $this->bulletType = $pValue;
157
158        return $this;
159    }
160
161    /**
162     * Get bullet font.
163     *
164     * @return string
165     */
166    public function getBulletFont()
167    {
168        return $this->bulletFont;
169    }
170
171    /**
172     * Set bullet font.
173     *
174     * @param string $pValue
175     *
176     * @return Bullet
177     */
178    public function setBulletFont($pValue = 'Calibri')
179    {
180        if ('' == $pValue) {
181            $pValue = 'Calibri';
182        }
183        $this->bulletFont = $pValue;
184
185        return $this;
186    }
187
188    /**
189     * Get bullet char.
190     *
191     * @return string
192     */
193    public function getBulletChar()
194    {
195        return $this->bulletChar;
196    }
197
198    /**
199     * Set bullet char.
200     *
201     * @param string $pValue
202     *
203     * @return Bullet
204     */
205    public function setBulletChar($pValue = '-')
206    {
207        $this->bulletChar = $pValue;
208
209        return $this;
210    }
211
212    /**
213     * Get bullet numeric style.
214     *
215     * @return string
216     */
217    public function getBulletNumericStyle()
218    {
219        return $this->bulletNumericStyle;
220    }
221
222    /**
223     * Set bullet numeric style.
224     *
225     * @param string $pValue
226     *
227     * @return Bullet
228     */
229    public function setBulletNumericStyle($pValue = self::NUMERIC_DEFAULT)
230    {
231        $this->bulletNumericStyle = $pValue;
232
233        return $this;
234    }
235
236    /**
237     * Get bullet numeric start at.
238     *
239     * @return int|string
240     */
241    public function getBulletNumericStartAt()
242    {
243        return $this->bulletNumericStartAt;
244    }
245
246    /**
247     * Set bullet numeric start at.
248     *
249     * @param int|string $pValue
250     *
251     * @return Bullet
252     */
253    public function setBulletNumericStartAt($pValue = 1)
254    {
255        $this->bulletNumericStartAt = $pValue;
256
257        return $this;
258    }
259
260    /**
261     * Get hash code.
262     *
263     * @return string Hash code
264     */
265    public function getHashCode(): string
266    {
267        return md5(
268            $this->bulletType
269            . $this->bulletFont
270            . $this->bulletChar
271            . $this->bulletNumericStyle
272            . $this->bulletNumericStartAt
273            . __CLASS__
274        );
275    }
276
277    /**
278     * Get hash index.
279     *
280     * Note that this index may vary during script execution! Only reliable moment is
281     * while doing a write of a workbook and when changes are not allowed.
282     *
283     * @return null|int Hash index
284     */
285    public function getHashIndex(): ?int
286    {
287        return $this->hashIndex;
288    }
289
290    /**
291     * Set hash index.
292     *
293     * Note that this index may vary during script execution! Only reliable moment is
294     * while doing a write of a workbook and when changes are not allowed.
295     *
296     * @param int $value Hash index
297     *
298     * @return $this
299     */
300    public function setHashIndex(int $value)
301    {
302        $this->hashIndex = $value;
303
304        return $this;
305    }
306
307    /**
308     * @return Color
309     */
310    public function getBulletColor()
311    {
312        return $this->bulletColor;
313    }
314
315    /**
316     * @return Bullet
317     */
318    public function setBulletColor(Color $bulletColor)
319    {
320        $this->bulletColor = $bulletColor;
321
322        return $this;
323    }
324}