Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
14 / 14
CRAP
100.00% covered (success)
100.00%
24 / 24
PresentationProperties
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
14 / 14
17
100.00% covered (success)
100.00%
24 / 24
 isLoopContinuouslyUntilEsc
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 setLoopContinuouslyUntilEsc
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 getThumbnailPath
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 setThumbnailPath
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
3 / 3
 markAsFinal
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 isMarkedAsFinal
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 setZoom
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 getZoom
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 setLastView
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
3 / 3
 getLastView
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 setCommentVisible
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 isCommentVisible
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 getSlideshowType
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 setSlideshowType
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
3 / 3
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 * @copyright   2009-2015 PHPPresentation contributors
16 * @license     http://www.gnu.org/licenses/lgpl.txt LGPL version 3
17 */
18
19declare(strict_types=1);
20
21namespace PhpOffice\PhpPresentation;
22
23class PresentationProperties
24{
25    public const VIEW_HANDOUT = 'handoutView';
26    public const VIEW_NOTES = 'notesView';
27    public const VIEW_NOTES_MASTER = 'notesMasterView';
28    public const VIEW_OUTLINE = 'outlineView';
29    public const VIEW_SLIDE = 'sldView';
30    public const VIEW_SLIDE_MASTER = 'sldMasterView';
31    public const VIEW_SLIDE_SORTER = 'sldSorterView';
32    public const VIEW_SLIDE_THUMBNAIL = 'sldThumbnailView';
33
34    /**
35     * @var array<int, string>
36     */
37    protected $arrayView = [
38        self::VIEW_HANDOUT,
39        self::VIEW_NOTES,
40        self::VIEW_NOTES_MASTER,
41        self::VIEW_OUTLINE,
42        self::VIEW_SLIDE,
43        self::VIEW_SLIDE_MASTER,
44        self::VIEW_SLIDE_SORTER,
45        self::VIEW_SLIDE_THUMBNAIL,
46    ];
47
48    public const SLIDESHOW_TYPE_PRESENT = 'present';
49    public const SLIDESHOW_TYPE_BROWSE = 'browse';
50    public const SLIDESHOW_TYPE_KIOSK = 'kiosk';
51
52    /**
53     * @var array<int, string>
54     */
55    protected $arraySlideshowTypes = [
56        self::SLIDESHOW_TYPE_PRESENT,
57        self::SLIDESHOW_TYPE_BROWSE,
58        self::SLIDESHOW_TYPE_KIOSK,
59    ];
60
61    /**
62     * @var bool
63     */
64    protected $isLoopUntilEsc = false;
65
66    /**
67     * Mark as final.
68     *
69     * @var bool
70     */
71    protected $markAsFinal = false;
72
73    /**
74     * @var string|null
75     */
76    protected $thumbnail;
77
78    /**
79     * Zoom.
80     *
81     * @var float
82     */
83    protected $zoom = 1.0;
84
85    /**
86     * @var string
87     */
88    protected $lastView = self::VIEW_SLIDE;
89
90    /**
91     * @var string
92     */
93    protected $slideshowType = self::SLIDESHOW_TYPE_PRESENT;
94
95    /**
96     * @var bool
97     */
98    protected $isCommentVisible = false;
99
100    public function isLoopContinuouslyUntilEsc(): bool
101    {
102        return $this->isLoopUntilEsc;
103    }
104
105    public function setLoopContinuouslyUntilEsc(bool $value = false): self
106    {
107        $this->isLoopUntilEsc = $value;
108
109        return $this;
110    }
111
112    /**
113     * Return the thumbnail file path.
114     *
115     * @return string|null
116     */
117    public function getThumbnailPath(): ?string
118    {
119        return $this->thumbnail;
120    }
121
122    /**
123     * Define the path for the thumbnail file / preview picture.
124     *
125     * @param string $path
126     *
127     * @return self
128     */
129    public function setThumbnailPath(string $path = ''): self
130    {
131        if (file_exists($path)) {
132            $this->thumbnail = $path;
133        }
134
135        return $this;
136    }
137
138    /**
139     * Mark a document as final.
140     */
141    public function markAsFinal(bool $state = true): self
142    {
143        $this->markAsFinal = $state;
144
145        return $this;
146    }
147
148    /**
149     * Return if this document is marked as final.
150     *
151     * @return bool
152     */
153    public function isMarkedAsFinal(): bool
154    {
155        return $this->markAsFinal;
156    }
157
158    /**
159     * Set the zoom of the document (in percentage).
160     */
161    public function setZoom(float $zoom = 1.0): self
162    {
163        $this->zoom = $zoom;
164
165        return $this;
166    }
167
168    /**
169     * Return the zoom (in percentage).
170     */
171    public function getZoom(): float
172    {
173        return $this->zoom;
174    }
175
176    /**
177     * @param string $value
178     *
179     * @return self
180     */
181    public function setLastView(string $value = self::VIEW_SLIDE): self
182    {
183        if (in_array($value, $this->arrayView)) {
184            $this->lastView = $value;
185        }
186
187        return $this;
188    }
189
190    /**
191     * @return string
192     */
193    public function getLastView(): string
194    {
195        return $this->lastView;
196    }
197
198    public function setCommentVisible(bool $value = false): self
199    {
200        $this->isCommentVisible = $value;
201
202        return $this;
203    }
204
205    public function isCommentVisible(): bool
206    {
207        return $this->isCommentVisible;
208    }
209
210    /**
211     * @return string
212     */
213    public function getSlideshowType(): string
214    {
215        return $this->slideshowType;
216    }
217
218    /**
219     * @param string $value
220     *
221     * @return self
222     */
223    public function setSlideshowType(string $value = self::SLIDESHOW_TYPE_PRESENT): self
224    {
225        if (in_array($value, $this->arraySlideshowTypes)) {
226            $this->slideshowType = $value;
227        }
228
229        return $this;
230    }
231}