Axis::deg2rad()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Bavix\Geo\Value;
4
5
/**
6
 * Class AxisProperty
7
 *
8
 * @package Bavix\Geo
9
 *
10
 * @property float $degrees
11
 * @property float $radian
12
 *
13
 * @method static Axis fromDegrees(float $value)
14
 * @method static Axis fromRadian(float $value)
15
 */
16
class Axis extends Valable
17
{
18
19
    const PROPERTY_DEGREES = 'degrees';
20
    const PROPERTY_RADIAN = 'radian';
21
22
    /**
23
     * @var array
24
     */
25
    protected $properties = [
26
        self::PROPERTY_DEGREES => [
27
            'type' => self::WRITE,
28
            'modify' => [
29
                self::PROPERTY_RADIAN => 'deg2rad'
30
            ],
31
        ],
32
        self::PROPERTY_RADIAN => [
33
            'type' => self::WRITE,
34
            'modify' => [
35
                self::PROPERTY_DEGREES => 'rad2deg'
36
            ],
37
        ],
38
    ];
39
40
    /**
41
     * @param float $value
42
     * @return float
43
     */
44
    protected function deg2rad(float $value): float
45
    {
46
        return \deg2rad($value);
47
    }
48
49
    /**
50
     * @param float $value
51
     * @return float
52
     */
53
    protected function rad2deg(float $value): float
54
    {
55
        return \rad2deg($value);
56
    }
57
58
}
59