Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
16 / 16
100.00% covered (success)
100.00%
9 / 9
CRAP
100.00% covered (success)
100.00%
1 / 1
Transition
100.00% covered (success)
100.00%
16 / 16
100.00% covered (success)
100.00%
9 / 9
11
100.00% covered (success)
100.00%
1 / 1
 setSpeed
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
2
 getSpeed
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setManualTrigger
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 hasManualTrigger
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setTimeTrigger
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
2
 hasTimeTrigger
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getAdvanceTimeTrigger
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setTransitionType
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getTransitionType
100.00% covered (success)
100.00%
1 / 1
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\Slide;
21
22/**
23 * Transition class.
24 */
25class Transition
26{
27    public const SPEED_FAST = 'fast';
28    public const SPEED_MEDIUM = 'med';
29    public const SPEED_SLOW = 'slow';
30
31    public const TRANSITION_BLINDS_HORIZONTAL = 'blinds_horz';
32    public const TRANSITION_BLINDS_VERTICAL = 'blinds_vert';
33    public const TRANSITION_CHECKER_HORIZONTAL = 'checker_horz';
34    public const TRANSITION_CHECKER_VERTICAL = 'checker_vert';
35    public const TRANSITION_CIRCLE = 'circle';
36    public const TRANSITION_COMB_HORIZONTAL = 'comb_horz';
37    public const TRANSITION_COMB_VERTICAL = 'comb_vert';
38    public const TRANSITION_COVER_DOWN = 'cover_d';
39    public const TRANSITION_COVER_LEFT = 'cover_l';
40    public const TRANSITION_COVER_LEFT_DOWN = 'cover_ld';
41    public const TRANSITION_COVER_LEFT_UP = 'cover_lu';
42    public const TRANSITION_COVER_RIGHT = 'cover_r';
43    public const TRANSITION_COVER_RIGHT_DOWN = 'cover_rd';
44    public const TRANSITION_COVER_RIGHT_UP = 'cover_ru';
45    public const TRANSITION_COVER_UP = 'cover_u';
46    public const TRANSITION_CUT = 'cut';
47    public const TRANSITION_DIAMOND = 'diamond';
48    public const TRANSITION_DISSOLVE = 'dissolve';
49    public const TRANSITION_FADE = 'fade';
50    public const TRANSITION_NEWSFLASH = 'newsflash';
51    public const TRANSITION_PLUS = 'plus';
52    public const TRANSITION_PULL_DOWN = 'pull_d';
53    public const TRANSITION_PULL_LEFT = 'pull_l';
54    public const TRANSITION_PULL_RIGHT = 'pull_r';
55    public const TRANSITION_PULL_UP = 'pull_u';
56    public const TRANSITION_PUSH_DOWN = 'push_d';
57    public const TRANSITION_PUSH_LEFT = 'push_l';
58    public const TRANSITION_PUSH_RIGHT = 'push_r';
59    public const TRANSITION_PUSH_UP = 'push_u';
60    public const TRANSITION_RANDOM = 'random';
61    public const TRANSITION_RANDOMBAR_HORIZONTAL = 'randomBar_horz';
62    public const TRANSITION_RANDOMBAR_VERTICAL = 'randomBar_vert';
63    public const TRANSITION_SPLIT_IN_HORIZONTAL = 'split_in_horz';
64    public const TRANSITION_SPLIT_OUT_HORIZONTAL = 'split_out_horz';
65    public const TRANSITION_SPLIT_IN_VERTICAL = 'split_in_vert';
66    public const TRANSITION_SPLIT_OUT_VERTICAL = 'split_out_vert';
67    public const TRANSITION_STRIPS_LEFT_DOWN = 'strips_ld';
68    public const TRANSITION_STRIPS_LEFT_UP = 'strips_lu';
69    public const TRANSITION_STRIPS_RIGHT_DOWN = 'strips_rd';
70    public const TRANSITION_STRIPS_RIGHT_UP = 'strips_ru';
71    public const TRANSITION_WEDGE = 'wedge';
72    public const TRANSITION_WIPE_DOWN = 'wipe_d';
73    public const TRANSITION_WIPE_LEFT = 'wipe_l';
74    public const TRANSITION_WIPE_RIGHT = 'wipe_r';
75    public const TRANSITION_WIPE_UP = 'wipe_u';
76    public const TRANSITION_ZOOM_IN = 'zoom_in';
77    public const TRANSITION_ZOOM_OUT = 'zoom_out';
78
79    /**
80     * @var bool
81     */
82    protected $hasManualTrigger = false;
83
84    /**
85     * @var bool
86     */
87    protected $hasTimeTrigger = false;
88
89    /**
90     * @var null|int
91     */
92    protected $advanceTimeTrigger;
93
94    /**
95     * @var null|string
96     */
97    protected $speed;
98
99    /**
100     * @var null|string
101     */
102    protected $transitionType;
103
104    public function setSpeed(?string $speed = self::SPEED_MEDIUM): self
105    {
106        if (in_array($speed, [self::SPEED_FAST, self::SPEED_MEDIUM, self::SPEED_SLOW])) {
107            $this->speed = $speed;
108        } else {
109            $this->speed = null;
110        }
111
112        return $this;
113    }
114
115    public function getSpeed(): ?string
116    {
117        return $this->speed;
118    }
119
120    public function setManualTrigger(bool $value = false): self
121    {
122        $this->hasManualTrigger = $value;
123
124        return $this;
125    }
126
127    public function hasManualTrigger(): bool
128    {
129        return $this->hasManualTrigger;
130    }
131
132    public function setTimeTrigger(bool $value = false, int $advanceTime = 1000): self
133    {
134        $this->hasTimeTrigger = $value;
135        $this->advanceTimeTrigger = true === $value ? $advanceTime : null;
136
137        return $this;
138    }
139
140    public function hasTimeTrigger(): bool
141    {
142        return $this->hasTimeTrigger;
143    }
144
145    public function getAdvanceTimeTrigger(): ?int
146    {
147        return $this->advanceTimeTrigger;
148    }
149
150    public function setTransitionType(?string $type = null): self
151    {
152        $this->transitionType = $type;
153
154        return $this;
155    }
156
157    public function getTransitionType(): ?string
158    {
159        return $this->transitionType;
160    }
161}