Completed
Push — master ( 66dbd9...44e5f7 )
by Marko
8s
created

AssetVideo::loop()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 3
nc 2
nop 1
crap 2
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            
0 ignored issues
show
Bug introduced by
There is no parameter named $preload. Was it maybe removed?

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 method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
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