Completed
Push — 0.3.x ( efb292...9f6509 )
by Marko
02:32
created

CursorComponent::fuseTimeout()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

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 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
/** @formatter:off
3
 * ******************************************************************
4
 * Created by   Marko Kungla on Jul 7, 2016 - 1:12:24 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         CursorComponent.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\Cursor;
25
26
use \AframeVR\Interfaces\Core\Components\CursorCMPTIF;
27
use \AframeVR\Core\Helpers\ComponentAbstract;
28
29
class CursorComponent extends ComponentAbstract implements CursorCMPTIF
30
{
31
32
    /**
33
     * Initialize Component
34
     *
35
     * {@inheritdoc}
36
     *
37
     * @return bool
38
     */
39 3
    public function initializeComponent(): bool
40
    {
41 3
        $this->setDomAttribute('cursor');
42 3
        $this->fuseTimeout();
43 3
        return true;
44
    }
45
    
46
    /**
47
     * Whether cursor is fuse-based.
48
     *
49
     * {@inheritdoc}
50
     *
51
     * @param bool $fuse            
52
     * @return CursorCMPTIF
53
     */
54 1
    public function fuse(bool $fuse = false): CursorCMPTIF
55
    {
56 1
        $this->dom_attributes['fuse'] = $fuse;
57 1
        return $this;
58
    }
59
60
    /**
61
     * fuseTimeout
62
     *
63
     * {@inheritdoc}
64
     *
65
     * @param int $timeout            
66
     * @return CursorCMPTIF
67
     */
68 3
    public function fuseTimeout(int $timeout = 1500): CursorCMPTIF
69
    {
70 3
        $this->dom_attributes['fuseTimeout'] = $timeout;
71 3
        return $this;
72
    }
73
}