GeoJSON   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 20
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A format() 0 12 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Location\Formatter\Coordinate;
6
7
use Location\Coordinate;
8
9
/**
10
 * GeoJSON Coordinate Formatter
11
 *
12
 * @author Marcus Jaschen <[email protected]>
13
 */
14
class GeoJSON implements FormatterInterface
15
{
16
    /**
17
     * @param Coordinate $coordinate
18
     *
19
     * @return string
20
     */
21
    public function format(Coordinate $coordinate): string
22
    {
23
        return json_encode(
24
            [
25
                'type'        => 'Point',
26
                'coordinates' => [
27
                    $coordinate->getLng(),
28
                    $coordinate->getLat(),
29
                ],
30
            ]
31
        );
32
    }
33
}
34