Completed
Pull Request — master (#63)
by Marko
03:19
created

Light::init()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
crap 1
1
<?php
2
/** @formatter:off
3
 * ******************************************************************
4
 * Created by   Marko Kungla on Jul 6, 2016 - 8:47:40 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         Light.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\Extras\Primitives;
25
26
use \AframeVR\Core\Entity;
27
use \AframeVR\Interfaces\EntityInterface;
28
29
class Light extends Entity implements EntityInterface
30
{
31
32
    /**
33
     * Init <a-light>
34
     *
35
     * The light primitive adjusts the lighting setup of the scene. It is an entity that maps attributes to properties
36
     * of the light component.
37
     * 
38
     * @return void
39
     */
40 1
    public function reset()
41
    {
42 1
        parent::reset();
43 1
        $this->component('Light');
44
        
45 1
    }
46
47
    /**
48
     * light.angle
49
     *
50
     * @param int|float $angle            
51
     * @return self
0 ignored issues
show
Documentation introduced by
Should the return type not be \self?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
52
     */
53
    public function angle(float $angle = 60): self
54
    {
55
        $this->component('Light')->angle($angle);
56
        return $this;
57
    }
58
59
    /**
60
     * light.color
61
     *
62
     * @param string $color            
63
     * @return self
64
     */
65
    public function color(string $color = '#fff'): EntityInterface
66
    {
67
        $this->component('Light')->color($color);
68
        return $this;
69
    }
70
71
    /**
72
     * light.decay
73
     *
74
     * @param int $decay            
75
     * @return self
0 ignored issues
show
Documentation introduced by
Should the return type not be \self?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
76
     */
77
    public function decay(int $decay = 1): self
78
    {
79
        $this->component('Light')->decay($decay);
80
        return $this;
81
    }
82
83
    /**
84
     * light.distance
85
     *
86
     * @param float $distance            
87
     * @return self
0 ignored issues
show
Documentation introduced by
Should the return type not be \self?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
88
     */
89
    public function distance(float $distance = 0.0): self
90
    {
91
        $this->component('Light')->distance($distance);
92
        return $this;
93
    }
94
95
    /**
96
     * light.exponent
97
     *
98
     * @param float $exponent            
99
     * @return self
0 ignored issues
show
Documentation introduced by
Should the return type not be \self?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
100
     */
101
    public function exponent(float $exponent = 10.0): self
102
    {
103
        $this->component('Light')->exponent($exponent);
104
        return $this;
105
    }
106
107
    /**
108
     * light.groundColor
109
     *
110
     * @param string $ground_color            
111
     * @return self
0 ignored issues
show
Documentation introduced by
Should the return type not be \self?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
112
     */
113
    public function groundColor(string $ground_color = '#fff'): self
114
    {
115
        $this->component('Light')->groundColor($ground_color);
116
        return $this;
117
    }
118
119
    /**
120
     * light.intensity
121
     *
122
     * @param float $intensity            
123
     * @return self
0 ignored issues
show
Documentation introduced by
Should the return type not be \self?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
124
     */
125
    public function intensity(float $intensity = 1.0): self
126
    {
127
        $this->component('Light')->intensity($intensity);
128
        return $this;
129
    }
130
131
    /**
132
     * light.type
133
     *
134
     * @param string $type            
135
     * @return self
0 ignored issues
show
Documentation introduced by
Should the return type not be \self?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
136
     */
137
    public function type(string $type = 'directional'): self
138
    {
139
        $this->component('Light')->type($type);
140
        return $this;
141
    }
142
}
143