Camera::far()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
ccs 6
cts 6
cp 1
rs 9.4285
cc 1
eloc 6
nc 1
nop 1
crap 1
1
<?php
2
/** @formatter:off
3
 * ******************************************************************
4
 * Created by   Marko Kungla on Jul 4, 2016 - 1:31:08 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         Camera.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 Camera extends Entity implements EntityInterface
30
{
31
32
    /**
33
     * Init <a-camera>
34
     *
35
     * The camera primitive places the user somewhere within the scene. It is an entity that prescribes the camera
36
     * component with mappings to controls-related components.
37
     *
38
     * @return void
39
     */
40 4
    public function reset()
41
    {
42 4
        parent::reset();
43 4
        $this->el()->entity()->attr('Camera');
0 ignored issues
show
Bug introduced by
The call to entity() misses a required argument $id.

This check looks for function calls that miss required arguments.

Loading history...
44 4
        $this->active(true);
45 4
        $this->lookControls(true);
46 4
        $this->wasdControls(true);
47 4
    }
48
49
    /**
50
     * camera.active
51
     *
52
     * @param bool $active
53
     * @return \AframeVR\Extras\Primitives\Camera
54
     */
55 4
    public function active(bool $active)
56
    {
57 4
        $this->el()
0 ignored issues
show
Bug introduced by
The call to entity() misses a required argument $id.

This check looks for function calls that miss required arguments.

Loading history...
58 4
            ->entity()
59 4
            ->attr('Camera')
60 4
            ->active($active);
61 4
        return $this;
62
    }
63
64
    /**
65
     * camera.far
66
     *
67
     * @param float $far
68
     * @return \AframeVR\Extras\Primitives\Camera
69
     */
70 2
    public function far(float $far)
71
    {
72 2
        $this->el()
0 ignored issues
show
Bug introduced by
The call to entity() misses a required argument $id.

This check looks for function calls that miss required arguments.

Loading history...
73 2
            ->entity()
74 2
            ->attr('Camera')
75 2
            ->far($far);
76 2
        return $this;
77
    }
78
79
    /**
80
     * camera.fov
81
     *
82
     * @param float $fov
83
     * @return \AframeVR\Extras\Primitives\Camera
84
     */
85 2
    public function fov(float $fov)
86
    {
87 2
        $this->el()
0 ignored issues
show
Bug introduced by
The call to entity() misses a required argument $id.

This check looks for function calls that miss required arguments.

Loading history...
88 2
            ->entity()
89 2
            ->attr('Camera')
90 2
            ->fov($fov);
91 2
        return $this;
92
    }
93
94
    /**
95
     * look-controls.enabled
96
     *
97
     * @param bool $look_controls
98
     * @return \AframeVR\Extras\Primitives\Camera
99
     */
100 4
    public function lookControls(bool $look_controls = true)
101
    {
102 4
        $this->el()
0 ignored issues
show
Bug introduced by
The call to entity() misses a required argument $id.

This check looks for function calls that miss required arguments.

Loading history...
103 4
            ->entity()
104 4
            ->attr('LookControls')
105 4
            ->enabled($look_controls);
106 4
        return $this;
107
    }
108
109
    /**
110
     * camera.near
111
     *
112
     * @param float $near
113
     * @return \AframeVR\Extras\Primitives\Camera
114
     */
115 2
    public function near(float $near)
116
    {
117 2
        $this->el()
0 ignored issues
show
Bug introduced by
The call to entity() misses a required argument $id.

This check looks for function calls that miss required arguments.

Loading history...
118 2
            ->entity()
119 2
            ->attr('Camera')
120 2
            ->near($near);
121 2
        return $this;
122
    }
123
124
    /**
125
     * wasd-controls.enabled
126
     *
127
     * @param bool $wasd_controls
128
     * @return \AframeVR\Extras\Primitives\Camera
129
     */
130 4
    public function wasdControls(bool $wasd_controls = true)
131
    {
132 4
        $this->el()
0 ignored issues
show
Bug introduced by
The call to entity() misses a required argument $id.

This check looks for function calls that miss required arguments.

Loading history...
133 4
            ->entity()
134 4
            ->attr('WASDControls')
135 4
            ->enabled($wasd_controls);
136 4
        return $this;
137
    }
138
139
    /**
140
     * camera.zoom
141
     *
142
     * @param float $zoom
143
     * @return \AframeVR\Extras\Primitives\Camera
144
     */
145 2
    public function zoom(float $zoom)
146
    {
147 2
        $this->el()
0 ignored issues
show
Bug introduced by
The call to entity() misses a required argument $id.

This check looks for function calls that miss required arguments.

Loading history...
148 2
            ->entity()
149 2
            ->attr('Camera')
150 2
            ->zoom($zoom);
151 2
        return $this;
152
    }
153
154
    /**
155
     * Activate cursor
156
     *
157
     * @return \AframeVR\Extras\Primitives\Camera
158
     */
159 2
    public function cursor()
160
    {
161 2
        $this->el()
0 ignored issues
show
Bug introduced by
The call to entity() misses a required argument $id.

This check looks for function calls that miss required arguments.

Loading history...
Bug introduced by
The call to cursor() misses a required argument $id.

This check looks for function calls that miss required arguments.

Loading history...
162 2
            ->entity()
163 2
            ->el()
164 2
            ->cursor();
165 2
        return $this;
166
    }
167
}
168
169