Completed
Branch master (fb685e)
by Marko
02:00
created

SphereMethods::thetaLength()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 4
loc 4
ccs 3
cts 3
cp 1
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
crap 1
1
<?php
2
/** @formatter:off
3
 * ******************************************************************
4
 * Created by   Marko Kungla on Jun 27, 2016 - 4:04:42 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         SphereMethods.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\Geometry\Methods;
25
26 View Code Duplication
class SphereMethods
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
27
{
28
29
    /**
30
     * The sphere primitive can define spheres in the traditional sense like a basketball.
31
     *
32
     * But it can also define various polyhedrons and abstract shapes given that it can specify
33
     * the number of horizontal and vertical angles and faces.
34
     *
35
     * Sticking with a basic sphere, the default number of segments is high enough to make the sphere appear round.
36
     */
37
    const DEFAULTS = array(
38
        /* Radius of the sphere. */
39
        'radius' => 1,
40
        /* Number of horizontal segments. */
41
        'segmentsWidth' => 18,
42
        /* Number of vertical segments. */
43
        'segmentsHeight' => 36,
44
        /* Horizontal starting angle. */
45
        'phiStart' => 0,
46
        /* Horizontal sweep angle size. */
47
        'phiLength' => 360,
48
        /* Vertical starting angle. */
49
        'thetaStart' => 0,
50
        /* Vertical sweep angle size. */
51
        'thetaLength' => 360
52
    );
53
54
    /**
55
     * Radius of the sphere.
56
     *
57
     * @param &array $dom_attributes            
0 ignored issues
show
Documentation introduced by
The doc-type &array could not be parsed: Unknown type name "&array" at position 0. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
58
     * @param float|int $radius            
0 ignored issues
show
Documentation introduced by
Consider making the type for parameter $radius a bit more specific; maybe use double.
Loading history...
59
     * @return void
60
     */
61 10
    public function radius(array &$dom_attributes, float $radius)
62
    {
63 10
        $dom_attributes['radius'] = $radius;
64 10
    }
65
66
    /**
67
     * Number of vertical segments.
68
     *
69
     * @param &array $dom_attributes            
0 ignored issues
show
Documentation introduced by
The doc-type &array could not be parsed: Unknown type name "&array" at position 0. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
70
     * @param int $segmentsHeight            
71
     * @return void
72
     */
73 10
    public function segmentsHeight(array &$dom_attributes, int $segmentsHeight)
74
    {
75 10
        $dom_attributes['segmentsHeight'] = $segmentsHeight;
76 10
    }
77
78
    /**
79
     * Number of horizontal segments.
80
     *
81
     * @param &array $dom_attributes            
0 ignored issues
show
Documentation introduced by
The doc-type &array could not be parsed: Unknown type name "&array" at position 0. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
82
     * @param int $segmentsWidth            
83
     * @return void
84
     */
85 10
    public function segmentsWidth(array &$dom_attributes, int $segmentsWidth)
86
    {
87 10
        $dom_attributes['segmentsWidth'] = $segmentsWidth;
88 10
    }
89
90
    /**
91
     * Horizontal starting angle.
92
     *
93
     * @param &array $dom_attributes            
0 ignored issues
show
Documentation introduced by
The doc-type &array could not be parsed: Unknown type name "&array" at position 0. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
94
     * @param float|int $phiStart            
0 ignored issues
show
Documentation introduced by
Consider making the type for parameter $phiStart a bit more specific; maybe use double.
Loading history...
95
     * @return void
96
     */
97 1
    public function phiStart(array &$dom_attributes, float $phiStart)
98
    {
99 1
        $dom_attributes['phiStart'] = $phiStart;
100 1
    }
101
102
    /**
103
     * Horizontal sweep angle size.
104
     *
105
     * @param &array $dom_attributes            
0 ignored issues
show
Documentation introduced by
The doc-type &array could not be parsed: Unknown type name "&array" at position 0. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
106
     * @param float|int $phiLength            
0 ignored issues
show
Documentation introduced by
Should the type for parameter $phiLength not be null|double?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
107
     * @return void
108
     */
109 1
    public function phiLength(array &$dom_attributes, float $phiLength = null)
110
    {
111 1
        $dom_attributes['phiLength'] = $phiLength;
112 1
    }
113
114
    /**
115
     * Vertical starting angle.
116
     *
117
     * @param &array $dom_attributes            
0 ignored issues
show
Documentation introduced by
The doc-type &array could not be parsed: Unknown type name "&array" at position 0. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
118
     * @param float|int $thetaStart            
0 ignored issues
show
Documentation introduced by
Consider making the type for parameter $thetaStart a bit more specific; maybe use double.
Loading history...
119
     * @return void
120
     */
121 1
    public function thetaStart(array &$dom_attributes, float $thetaStart)
122
    {
123 1
        $dom_attributes['thetaStart'] = $thetaStart;
124 1
    }
125
126
    /**
127
     * Vertical sweep angle size.
128
     *
129
     * @param &array $dom_attributes            
0 ignored issues
show
Documentation introduced by
The doc-type &array could not be parsed: Unknown type name "&array" at position 0. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
130
     * @param float|int $thetaLength            
0 ignored issues
show
Documentation introduced by
Consider making the type for parameter $thetaLength a bit more specific; maybe use double.
Loading history...
131
     * @return void
132
     */
133 1
    public function thetaLength(array &$dom_attributes, float $thetaLength)
134
    {
135 1
        $dom_attributes['thetaLength'] = $thetaLength;
136 1
    }
137
}
138