Distable   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
c 0
b 0
f 0
dl 0
loc 20
rs 10
wmc 5

1 Method

Rating   Name   Duplication   Size   Complexity  
A modify() 0 11 5
1
<?php
2
3
namespace Bavix\Geo\Unit;
4
5
use Bavix\Geo\Value\Valable;
6
7
abstract class Distable implements DistanceInterface
8
{
9
10
    /**
11
     * @param Valable $object
12
     * @param string $name
13
     * @param string $prop
14
     * @return mixed
15
     */
16
    public static function modify(Valable $object, string $name, string $prop)
17
    {
18
        if ($name === Distance::PROPERTY_MILES && $prop === static::property()) {
19
            return $object->$name * static::oneMile();
20
        }
21
22
        if ($prop === Distance::PROPERTY_MILES && $name === static::property()) {
23
            $object->$prop = $object->$name / static::oneMile();
24
        }
25
26
        return null;
27
    }
28
29
}
30