1 | <?php |
||
21 | class Sound implements \JsonSerializable |
||
22 | { |
||
23 | const SOUND_CRITICAL_KEY = 'critical'; |
||
24 | const SOUND_NAME_KEY = 'name'; |
||
25 | const SOUND_VOLUME_KEY = 'volume'; |
||
26 | |||
27 | /** |
||
28 | * Whether the sound should be played as a critical notification or not |
||
29 | * |
||
30 | * @var integer |
||
31 | */ |
||
32 | private $critical; |
||
33 | |||
34 | /** |
||
35 | * The sound file name. |
||
36 | * |
||
37 | * @var string |
||
38 | */ |
||
39 | private $name; |
||
40 | |||
41 | /** |
||
42 | * The sound volume. |
||
43 | * |
||
44 | * @var float |
||
45 | */ |
||
46 | private $volume; |
||
47 | |||
48 | protected function __construct() |
||
51 | |||
52 | public static function create() |
||
56 | |||
57 | /** |
||
58 | * Set Sound critical. |
||
59 | * |
||
60 | * @param int $value |
||
61 | * @return Sound |
||
62 | */ |
||
63 | public function setCritical(int $value): Sound |
||
69 | |||
70 | /** |
||
71 | * Get Sound critical. |
||
72 | * |
||
73 | * @return string |
||
74 | */ |
||
75 | public function getCritical() |
||
79 | |||
80 | /** |
||
81 | * Set Sound name. |
||
82 | * |
||
83 | * @param string $value |
||
84 | * @return Sound |
||
85 | */ |
||
86 | public function setName(string $value): Sound |
||
92 | |||
93 | /** |
||
94 | * Get Sound name. |
||
95 | * |
||
96 | * @return string |
||
97 | */ |
||
98 | public function getName() |
||
102 | |||
103 | /** |
||
104 | * Set Sound volume. |
||
105 | * |
||
106 | * @param float $value |
||
107 | * @return Sound |
||
108 | */ |
||
109 | public function setVolume(float $value): Sound |
||
115 | |||
116 | /** |
||
117 | * Get Sound volume. |
||
118 | * |
||
119 | * @return float |
||
120 | */ |
||
121 | public function getVolume() |
||
125 | |||
126 | /** |
||
127 | * Convert Sound to JSON. |
||
128 | * |
||
129 | * @return string |
||
130 | */ |
||
131 | public function toJson(): string |
||
135 | |||
136 | /** |
||
137 | * Specify data which should be serialized to JSON. |
||
138 | * |
||
139 | * @return array |
||
140 | * @link http://php.net/manual/en/jsonserializable.jsonserialize.php |
||
141 | */ |
||
142 | public function jsonSerialize() |
||
160 | } |
||
161 |