CoordinateFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 24
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createFromRadians() 0 4 1
A createFromDegrees() 0 4 1
1
<?php
2
namespace Nubs\Coordinator;
3
4
use Nubs\Coordinator\Coordinate;
5
6
class CoordinateFactory
7
{
8
    /**
9
     * Initialize a coordinate from radians.
10
     *
11
     * @param float $latitude The latitude in radians.
12
     * @param float $longitude The longitude in radians.
13
     */
14
    public function createFromRadians($latitude, $longitude)
15
    {
16
        return new Coordinate($latitude, $longitude);
17
    }
18
19
    /**
20
     * Initialize a coordinate from degrees.
21
     *
22
     * @param float $latitude The latitude in degrees.
23
     * @param float $longitude The longitude in degrees.
24
     */
25
    public function createFromDegrees($latitude, $longitude)
26
    {
27
        return new Coordinate(deg2rad($latitude), deg2rad($longitude));
28
    }
29
}
30