1
|
|
|
<?php |
2
|
|
|
/** @formatter:off |
3
|
|
|
* ****************************************************************** |
4
|
|
|
* Created by Marko Kungla on Jul 3, 2016 - 7:08:14 PM |
5
|
|
|
* Contact [email protected] |
6
|
|
|
* @copyright 2016 Marko Kungla - https://github.com/mkungla |
7
|
|
|
* @license The MIT License (MIT) |
8
|
|
|
* |
9
|
|
|
* @category AframeVR |
10
|
|
|
* @package aframe-php |
11
|
|
|
* |
12
|
|
|
* Lang PHP (php version >= 7) |
13
|
|
|
* Encoding UTF-8 |
14
|
|
|
* File AssetVideo.php |
15
|
|
|
* Code format PSR-2 and 12 |
16
|
|
|
* @link https://github.com/mkungla/aframe-php |
17
|
|
|
* @issues https://github.com/mkungla/aframe-php/issues |
18
|
|
|
* ******************************************************************** |
19
|
|
|
* Contributors: |
20
|
|
|
* @author Marko Kungla <[email protected]> |
21
|
|
|
* ******************************************************************** |
22
|
|
|
* Comments: |
23
|
|
|
* @formatter:on */ |
24
|
|
|
namespace AframeVR\Core\Assets; |
25
|
|
|
|
26
|
|
|
use \AframeVR\Interfaces\Core\Assets\AssetVideoInterface; |
27
|
|
|
use \AframeVR\Core\Helpers\AssetsAbstract; |
28
|
|
|
|
29
|
|
|
final class AssetVideo extends AssetsAbstract implements AssetVideoInterface |
30
|
|
|
{ |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Autoplay video |
34
|
|
|
* |
35
|
|
|
* @var bool |
36
|
|
|
*/ |
37
|
|
|
protected $attr_autoplay; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Preload video |
41
|
|
|
* |
42
|
|
|
* @var string |
43
|
|
|
*/ |
44
|
|
|
protected $attr_preload; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Image crossorigin |
48
|
|
|
* |
49
|
|
|
* @var string |
50
|
|
|
*/ |
51
|
|
|
protected $attr_crossorigin; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Asset constructor set asset ID |
55
|
|
|
* |
56
|
|
|
* @param string $id |
57
|
|
|
*/ |
58
|
1 |
|
public function __construct(string $id) |
59
|
|
|
{ |
60
|
1 |
|
$this->id($id); |
61
|
1 |
|
$this->setDomElementTag('video'); |
62
|
1 |
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Autoplay video |
66
|
|
|
* |
67
|
|
|
* @param bool $autoplay |
68
|
|
|
* @return AssetVideoInterface |
69
|
|
|
*/ |
70
|
1 |
|
public function autoplay(bool $autoplay = true): AssetVideoInterface |
71
|
|
|
{ |
72
|
1 |
|
$this->attrs['autoplay'] = $autoplay ? 'true' : 'false'; |
73
|
1 |
|
return $this; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* loop video |
78
|
|
|
* |
79
|
|
|
* @param string $preload |
|
|
|
|
80
|
|
|
* @return AssetVideoInterface |
81
|
|
|
*/ |
82
|
1 |
|
public function loop(bool $loop = true): AssetVideoInterface |
83
|
|
|
{ |
84
|
1 |
|
$this->attrs['loop'] = $loop ? 'true' : 'false'; |
85
|
1 |
|
return $this; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* Preload video |
90
|
|
|
* |
91
|
|
|
* @param string $preload |
92
|
|
|
* @return AssetVideoInterface |
93
|
|
|
*/ |
94
|
1 |
|
public function preload(string $preload = 'auto'): AssetVideoInterface |
95
|
|
|
{ |
96
|
1 |
|
$this->attrs['preload'] = $preload; |
97
|
1 |
|
return $this; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* Set crossorigin attribute of the video |
102
|
|
|
* |
103
|
|
|
* @param string $crossorigin |
104
|
|
|
* @return AssetVideoInterface |
105
|
|
|
*/ |
106
|
1 |
|
public function crossorigin(string $crossorigin = 'anonymous'): AssetVideoInterface |
107
|
|
|
{ |
108
|
1 |
|
$this->attrs['crossorigin'] = $crossorigin; |
109
|
1 |
|
return $this; |
110
|
|
|
} |
111
|
|
|
} |
112
|
|
|
|
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.