CoordinateFactory::createFromRadians()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 2
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