Completed
Pull Request — develop (#356)
by
unknown
12:54
created

Axis::getDelete()   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 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
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;
19
20
use PhpOffice\PhpPresentation\ComparableInterface;
21
use PhpOffice\PhpPresentation\Style\Font;
22
use PhpOffice\PhpPresentation\Style\Outline;
23
24
/**
25
 * \PhpOffice\PhpPresentation\Shape\Chart\Axis
26
 */
27
class Axis implements ComparableInterface
28
{
29
    const AXIS_X = 'x';
30
    const AXIS_Y = 'y';
31
32
    const TICK_MARK_NONE = 'none';
33
    const TICK_MARK_CROSS = 'cross';
34
    const TICK_MARK_INSIDE = 'in';
35
    const TICK_MARK_OUTSIDE = 'out';
36
37
    /**
38
     * Title
39
     *
40
     * @var string
41
     */
42
    private $title = 'Axis Title';
43
44
    /**
45
     * Format code
46
     *
47
     * @var string
48
     */
49
    private $formatCode = '';
50
51
    /**
52
     * Font
53
     *
54
     * @var \PhpOffice\PhpPresentation\Style\Font
55
     */
56
    private $font;
57
58
    /**
59
     * @var Gridlines
60
     */
61
    protected $majorGridlines;
62
63
    /**
64
     * @var Gridlines
65
     */
66
    protected $minorGridlines;
67
68
    /**
69
     * @var int
70
     */
71
    protected $minBounds;
72
73
    /**
74
     * @var int
75
     */
76
    protected $maxBounds;
77
78
    /**
79
     * @var string
80
     */
81
    protected $minorTickMark = self::TICK_MARK_NONE;
82
83
    /**
84
     * @var string
85
     */
86
    protected $majorTickMark = self::TICK_MARK_NONE;
87
88
    /**
89
     * @var float
90
     */
91
    protected $minorUnit;
92
93
    /**
94
     * @var float
95
     */
96
    protected $majorUnit;
97
98
    /**
99
     * @var Outline
100
     */
101
    protected $outline;
102
103
    /**
104
     * @var int
105
     */
106
    protected $deleted;
107
108
    /**
109
     * Create a new \PhpOffice\PhpPresentation\Shape\Chart\Axis instance
110
     *
111
     * @param string $title Title
112
     */
113 76
    public function __construct($title = 'Axis Title')
114
    {
115 76
        $this->title = $title;
116 76
        $this->outline = new Outline();
117 76
        $this->font  = new Font();
118 76
    }
119
120
    /**
121
     * Get Title
122
     *
123
     * @return string
124
     */
125 2
    public function getTitle()
126
    {
127 2
        return $this->title;
128
    }
129
130
    /**
131
     * Set Title
132
     *
133
     * @param  string                         $value
134
     * @return \PhpOffice\PhpPresentation\Shape\Chart\Axis
135
     */
136 1
    public function setTitle($value = 'Axis Title')
137
    {
138 1
        $this->title = $value;
139
140 1
        return $this;
141
    }
142
143
    /**
144
     * Get font
145
     *
146
     * @return \PhpOffice\PhpPresentation\Style\Font
147
     */
148 26
    public function getFont()
149
    {
150 26
        return $this->font;
151
    }
152
153
    /**
154
     * Set font
155
     *
156
     * @param  \PhpOffice\PhpPresentation\Style\Font               $pFont Font
157
     * @throws \Exception
158
     * @return \PhpOffice\PhpPresentation\Shape\RichText\Paragraph
159
     */
160 1
    public function setFont(Font $pFont = null)
161
    {
162 1
        $this->font = $pFont;
163 1
        return $this;
164
    }
165
166
    /**
167
     * Get Format Code
168
     *
169
     * @return string
170
     */
171 1
    public function getFormatCode()
172
    {
173 1
        return $this->formatCode;
174
    }
175
176
    /**
177
     * Set Format Code
178
     *
179
     * @param  string                         $value
180
     * @return \PhpOffice\PhpPresentation\Shape\Chart\Axis
181
     */
182 1
    public function setFormatCode($value = '')
183
    {
184 1
        $this->formatCode = $value;
185
186 1
        return $this;
187
    }
188
189
    /**
190
     * @return int|null
191
     */
192 50
    public function getMinBounds()
193
    {
194 50
        return $this->minBounds;
195
    }
196
197
    /**
198
     * @param int|null $minBounds
199
     * @return Axis
200
     */
201 2
    public function setMinBounds($minBounds = null)
202
    {
203 2
        $this->minBounds = is_null($minBounds) ? null : (int)$minBounds;
204 2
        return $this;
205
    }
206
207
    /**
208
     * @return int|null
209
     */
210 50
    public function getMaxBounds()
211
    {
212 50
        return $this->maxBounds;
213
    }
214
215
    /**
216
     * @param int|null $maxBounds
217
     * @return Axis
218
     */
219 2
    public function setMaxBounds($maxBounds = null)
220
    {
221 2
        $this->maxBounds = is_null($maxBounds) ? null : (int)$maxBounds;
222 2
        return $this;
223
    }
224
225
    /**
226
     * @return Gridlines
227
     */
228 25
    public function getMajorGridlines()
229
    {
230 25
        return $this->majorGridlines;
231
    }
232
233
    /**
234
     * @param Gridlines $majorGridlines
235
     * @return Axis
236
     */
237 3
    public function setMajorGridlines(Gridlines $majorGridlines)
238
    {
239 3
        $this->majorGridlines = $majorGridlines;
240 3
        return $this;
241
    }
242
243
    /**
244
     * @return Gridlines
245
     */
246 25
    public function getMinorGridlines()
247
    {
248 25
        return $this->minorGridlines;
249
    }
250
251
    /**
252
     * @param Gridlines $minorGridlines
253
     * @return Axis
254
     */
255 2
    public function setMinorGridlines(Gridlines $minorGridlines)
256
    {
257 2
        $this->minorGridlines = $minorGridlines;
258 2
        return $this;
259
    }
260
261
    /**
262
     * @return string
263
     */
264 1
    public function getMinorTickMark()
265
    {
266 1
        return $this->minorTickMark;
267
    }
268
269
    /**
270
     * @param string $pTickMark
271
     * @return Axis
272
     */
273 1
    public function setMinorTickMark($pTickMark = self::TICK_MARK_NONE)
274
    {
275 1
        $this->minorTickMark = $pTickMark;
276 1
        return $this;
277
    }
278
279
    /**
280
     * @return string
281
     */
282 1
    public function getMajorTickMark()
283
    {
284 1
        return $this->majorTickMark;
285
    }
286
287
    /**
288
     * @param string $pTickMark
289
     * @return Axis
290
     */
291 1
    public function setMajorTickMark($pTickMark = self::TICK_MARK_NONE)
292
    {
293 1
        $this->majorTickMark = $pTickMark;
294 1
        return $this;
295
    }
296
297
    /**
298
     * @return float
299
     */
300 1
    public function getMinorUnit()
301
    {
302 1
        return $this->minorUnit;
303
    }
304
305
    /**
306
     * @param float $pUnit
307
     * @return Axis
308
     */
309 1
    public function setMinorUnit($pUnit = null)
310
    {
311 1
        $this->minorUnit = $pUnit;
312 1
        return $this;
313
    }
314
315
    /**
316
     * @return float
317
     */
318 1
    public function getMajorUnit()
319
    {
320 1
        return $this->majorUnit;
321
    }
322
323
    /**
324
     * @param float $pUnit
325
     * @return Axis
326
     */
327 1
    public function setMajorUnit($pUnit = null)
328
    {
329 1
        $this->majorUnit = $pUnit;
330 1
        return $this;
331
    }
332
333
    /**
334
     * @return Outline
335
     */
336 1
    public function getOutline()
337
    {
338 1
        return $this->outline;
339
    }
340
341
    /**
342
     * @param Outline $outline
343
     * @return Axis
344
     */
345
    public function setOutline($outline)
346
    {
347
        $this->outline = $outline;
348
        return $this;
349
    }
350
351
    /**
352
     * Get hash code
353
     *
354
     * @return string Hash code
355
     */
356 56
    public function getHashCode()
357
    {
358 56
        return md5($this->title . $this->formatCode . __CLASS__);
359
    }
360
361
    /**
362
     * Hash index
363
     *
364
     * @var string
365
     */
366
    private $hashIndex;
367
368
    /**
369
     * Get hash index
370
     *
371
     * Note that this index may vary during script execution! Only reliable moment is
372
     * while doing a write of a workbook and when changes are not allowed.
373
     *
374
     * @return string Hash index
375
     */
376 1
    public function getHashIndex()
377
    {
378 1
        return $this->hashIndex;
379
    }
380
381
    /**
382
     * Set hash index
383
     *
384
     * Note that this index may vary during script execution! Only reliable moment is
385
     * while doing a write of a workbook and when changes are not allowed.
386
     *
387
     * @param string $value Hash index
388
     */
389 1
    public function setHashIndex($value)
390
    {
391 1
        $this->hashIndex = $value;
392 1
        return $this;
393
    }
394
395
    /**
396
     * Axis deleted and not visible?
397
     *
398
     * @return int Hash index
399
     */
400 26
    public function getDelete()
401
    {
402 26
        return $this->delete;
0 ignored issues
show
Bug introduced by
The property delete does not seem to exist. Did you mean deleted?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
403
    }
404
405
    /**
406
     * Remove an axis.
407
     * 0 not deleted, 1 = deleted and not visible
408
     *
409
     * @param int $value delete
410
     */
411
    public function setDelete($value)
412
    {
413
        $this->delete = $value;
0 ignored issues
show
Bug introduced by
The property delete does not seem to exist. Did you mean deleted?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
414
        return $this;
415
    }
416
}
417