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

Cylinder   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 120
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 14.29%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 9
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 120
ccs 5
cts 35
cp 0.1429
rs 10

9 Methods

Rating   Name   Duplication   Size   Complexity  
A reset() 0 6 1
A defaults() 0 10 1
A height() 0 5 1
A openEnded() 0 5 1
A radius() 0 5 1
A segmentsHeight() 0 5 1
A segmentsRadial() 0 5 1
A thetaLength() 0 5 1
A thetaStart() 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 1
    public function reset()
41
    {
42 1
        parent::reset();
43 1
        $this->component('Material');
44 1
        $this->component('Geometry')->primitive('cylinder');
45 1
    }
46
47
    /**
48
     * Set defaults
49
     *
50
     * {@inheritdoc}
51
     *
52
     * @return void
53
     */
54
    public function defaults()
55
    {
56
        $this->height(1);
57
        $this->openEnded(false);
58
        $this->radius(1);
59
        $this->segmentsHeight(18);
60
        $this->segmentsRadial(36);
61
        $this->thetaLength(360);
62
        $this->thetaStart(0);
63
    }
64
65
    /**
66
     * geometry.height
67
     *
68
     * @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...
69
     * @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...
70
     */
71
    public function height(float $height): self
72
    {
73
        $this->component('Geometry')->height($height);
74
        return $this;
75
    }
76
77
    /**
78
     * geometry.openEnded
79
     *
80
     * @param bool $openEnded            
81
     * @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...
82
     */
83
    public function openEnded(bool $openEnded = false): self
84
    {
85
        $this->component('Geometry')->openEnded($openEnded);
86
        return $this;
87
    }
88
89
    /**
90
     * geometry.radius
91
     *
92
     * @param float $radius            
93
     * @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...
94
     */
95
    public function radius(float $radius = 0.75): self
96
    {
97
        $this->component('Geometry')->radius($radius);
98
        return $this;
99
    }
100
101
    /**
102
     * geometry.segmentsHeight
103
     *
104
     * @param int $segmentsHeight            
105
     * @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...
106
     */
107
    public function segmentsHeight(int $segmentsHeight = 1): self
108
    {
109
        $this->component('Geometry')->segmentsHeight($segmentsHeight);
110
        return $this;
111
    }
112
113
    /**
114
     * geometry.segmentsRadial
115
     *
116
     * @param int $segmentsRadial            
117
     * @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...
118
     */
119
    public function segmentsRadial(int $segmentsRadial = 36): self
120
    {
121
        $this->component('Geometry')->segmentsHeight($segmentsRadial);
122
        return $this;
123
    }
124
125
    /**
126
     * geometry.thetaLength
127
     *
128
     * @param int $thetaLength            
129
     * @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...
130
     */
131
    public function thetaLength(int $thetaLength = 360): self
132
    {
133
        $this->component('Geometry')->thetaLength($thetaLength);
134
        return $this;
135
    }
136
137
    /**
138
     * geometry.thetaStart
139
     *
140
     * @param int $thetaStart            
141
     * @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...
142
     */
143
    public function thetaStart(int $thetaStart = 0): self
144
    {
145
        $this->component('Geometry')->thetaStart($thetaStart);
146
        return $this;
147
    }
148
}
149