Failed Conditions
Pull Request — dev (#51)
by Jordan
03:19
created

ComplexNumbers   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 14
ccs 0
cts 7
cp 0
rs 10
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A make() 0 8 4
1
<?php
2
3
namespace Samsara\Fermat;
4
5
use Samsara\Fermat\Values\ImmutableComplexNumber;
6
use Samsara\Fermat\Values\MutableComplexNumber;
7
8
class ComplexNumbers
9
{
10
11
    const IMMUTABLE = ImmutableComplexNumber::class;
12
    const MUTABLE = MutableComplexNumber::class;
13
14
    public static function make($type, $value)
15
    {
16
17
        if (is_string($value)) {
18
            if ($type == self::IMMUTABLE) {
19
                return ImmutableComplexNumber::makeFromString($value);
20
            } elseif ($type == self::MUTABLE) {
21
                return MutableComplexNumber::makeFromString($value);
22
            }
23
        }
24
25
    }
26
27
}