Completed
Push — master ( f87c77...be4ea7 )
by Marko
02:11
created

AssetImage   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 35
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A crossorigin() 0 5 1
1
<?php
2
/** @formatter:off
3
 * ******************************************************************
4
 * Created by   Marko Kungla on Jul 3, 2016 - 6:22:51 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         AssetImage.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\AssetImageInterface;
27
use \AframeVR\Core\Helpers\AssetsAbstract;
28
29
final class AssetImage extends AssetsAbstract implements AssetImageInterface
30
{
31
32
    /**
33
     * Image crossorigin
34
     *
35
     * @var string
36
     */
37
    protected $attr_crossorigin;
38
39
    /**
40
     * Image crossorigin
41
     *
42
     * Asset constructor set asset ID
43
     *
44
     * @param string $id            
45
     */
46 1
    public function __construct(string $id)
47
    {
48 1
        $this->id($id);
49 1
        $this->setDomElementTag('img');
50 1
    }
51
52
    /**
53
     * Set crossorigin attribute of the image
54
     *
55
     * @param string $crossorigin            
56
     * @return AssetImageInterface
57
     */
58 1
    public function crossorigin(string $crossorigin = 'anonymous'): AssetImageInterface
59
    {
60 1
        $this->attr_crossorigin = $crossorigin;
61 1
        return $this;
62
    }
63
}
64