Completed
Push — master ( e8b22d...bec3f6 )
by Marko
11s
created

Cylinder::defaults()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 10
ccs 9
cts 9
cp 1
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 8
nc 1
nop 0
crap 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A Cylinder::openEnded() 0 5 1
1
<?php
2
/** @formatter:off
3
 * ******************************************************************
4
 * Created by   Marko Kungla on Jun 21, 2016 - 12:24:13 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         Cylinder.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 Cylinder extends Entity implements EntityInterface
30
{
31
32
    /**
33
     * <a-cylinder>
34
     *
35
     * The cylinder primitive is an entity that prescribes the geometry with its geometric primitive set to cylinder.
36
     * It can be used to create tubes and curved surfaces.
37
     * 
38
     * @return void
39
     */
40 3
    public function reset()
41
    {
42 3
        parent::reset();
43 3
        $this->component('Material');
44 3
        $this->component('Geometry')->primitive('cylinder');
45 3
    }
46
47
    /**
48
     * geometry.height
49
     *
50
     * @param int|float $height            
0 ignored issues
show
Documentation introduced by
Consider making the type for parameter $height a bit more specific; maybe use double.
Loading history...
51
     * @return self
52
     */
53 2
    public function height(float $height)
54
    {
55 2
        $this->component('Geometry')->height($height);
56 2
        return $this;
57
    }
58
59
    /**
60
     * geometry.openEnded
61
     *
62
     * @param bool $openEnded            
63
     * @return self
64
     */
65 2
    public function openEnded(bool $openEnded = false)
66
    {
67 2
        $this->component('Geometry')->openEnded($openEnded);
68 2
        return $this;
69
    }
70
71
    /**
72
     * geometry.radius
73
     *
74
     * @param float $radius            
75
     * @return self
76
     */
77 2
    public function radius(float $radius)
78
    {
79 2
        $this->component('Geometry')->radius($radius);
80 2
        return $this;
81
    }
82
83
    /**
84
     * geometry.segmentsHeight
85
     *
86
     * @param int $segmentsHeight            
87
     * @return self
88
     */
89 2
    public function segmentsHeight(int $segmentsHeight)
90
    {
91 2
        $this->component('Geometry')->segmentsHeight($segmentsHeight);
92 2
        return $this;
93
    }
94
95
    /**
96
     * geometry.segmentsRadial
97
     *
98
     * @param int $segmentsRadial            
99
     * @return self
100
     */
101 2
    public function segmentsRadial(int $segmentsRadial)
102
    {
103 2
        $this->component('Geometry')->segmentsRadial($segmentsRadial);
104 2
        return $this;
105
    }
106
107
    /**
108
     * geometry.thetaLength
109
     *
110
     * @param int $thetaLength            
111
     * @return self
112
     */
113 2
    public function thetaLength(int $thetaLength)
114
    {
115 2
        $this->component('Geometry')->thetaLength($thetaLength);
116 2
        return $this;
117
    }
118
119
    /**
120
     * geometry.thetaStart
121
     *
122
     * @param int $thetaStart            
123
     * @return self
124
     */
125 2
    public function thetaStart(int $thetaStart)
126
    {
127 2
        $this->component('Geometry')->thetaStart($thetaStart);
128 2
        return $this;
129
    }
130
}
131