MyDistance   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 4
c 1
b 0
f 1
dl 0
loc 25
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A property() 0 3 1
A oneMile() 0 3 1
A name() 0 3 1
1
<?php
2
3
include_once dirname(__DIR__) . '/vendor/autoload.php';
4
5
class MyDistance extends \Bavix\Geo\Unit\Distable
6
{
7
8
    /**
9
     * @return string
10
     */
11
    public static function property(): string
12
    {
13
        return Distance::PROPERTY_MY_DISTANCE;
14
    }
15
16
    /**
17
     * @return string
18
     */
19
    public static function name(): string
20
    {
21
        return 'my distance';
22
    }
23
24
    /**
25
     * @return float
26
     */
27
    public static function oneMile(): float
28
    {
29
        return .5;
30
    }
31
32
}
33
34
/**
35
 * Class Distance
36
 * @property-read float $myDistance
37
 */
38
class Distance extends \Bavix\Geo\Unit\Distance
39
{
40
    const PROPERTY_MY_DISTANCE = 'myDistance';
41
42
    protected $extends = [
43
        self::PROPERTY_MY_DISTANCE => [
44
            'type' => self::READ_ONLY
45
        ],
46
        \Bavix\Geo\Unit\Distance::PROPERTY_MILES => [
47
            'modify' => [
48
                self::PROPERTY_MY_DISTANCE => MyDistance::class
49
            ],
50
        ],
51
    ];
52
}
53
54
$distance = new Distance([
55
    Distance::PROPERTY_MILES => 10
56
]);
57
58
var_dump($distance->myDistance);
59
var_dump($distance->wheels);
60