Completed
Push — master ( 95af13...697c38 )
by Marko
8s
created

LookControlsComponent   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 1
cbo 1
dl 0
loc 30
ccs 6
cts 6
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A initializeComponent() 0 5 1
A enabled() 0 5 2
1
<?php
2
/** @formatter:off
3
 * ******************************************************************
4
 * Created by   Marko Kungla on Jul 4, 2016 - 3:14:06 AM
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         LookControlsComponent.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\Components\LookControls;
25
26
use \AframeVR\Interfaces\Core\Components\LookControls\LookControlsInterface;
27
use \AframeVR\Core\Helpers\ComponentAbstract;
28
29
class LookControlsComponent extends ComponentAbstract implements LookControlsInterface
30
{
31
32
    /**
33
     * Initialize Component
34
     * 
35
     * {@inheritdoc}
36
     *
37
     * @return bool
38
     */
39 6
    public function initializeComponent(): bool
40
    {
41 6
        $this->setDomAttribute('look-controls');
42 6
        return true;
43
    }
44
45
    /**
46
     * look-controls enabled
47
     * 
48
     * {@inheritdoc}
49
     * 
50
     * @param bool $enabled
51
     * @return LookControlsInterface
52
     */
53 6
    public function enabled(bool $enabled = true): LookControlsInterface
54
    {
55 6
        $this->dom_attributes['enabled'] = $enabled ? 'true' : 'false';
56 6
        return $this;
57
    }
58
}
59