Coordinates   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A getLat() 0 4 1
A getLong() 0 4 1
1
<?php
2
3
namespace AlexeyKuperhstokh\LocationBundle\Location;
4
5
use Symfony\Component\OptionsResolver\Options;
6
use Symfony\Component\OptionsResolver\OptionsResolver;
7
8
class Coordinates
9
{
10
    /**
11
     * @var array
12
     */
13
    protected $options;
14
15
    /**
16
     * @param array $options
17
     */
18
    public function __construct($options)
19
    {
20
        $resolver = new OptionsResolver();
21
        $resolver->setRequired('lat');
22
        $resolver->setRequired('long');
23
        $resolver->addAllowedTypes('lat', array('float', 'int'));
24
        $resolver->addAllowedTypes('long', array('float', 'int'));
25
        $this->options = $resolver->resolve($options);
26
    }
27
28
    /**
29
     * @return float
30
     */
31
    public function getLat()
32
    {
33
        return $this->options['lat'];
34
    }
35
36
    /**
37
     * @return float
38
     */
39
    public function getLong()
40
    {
41
        return $this->options['long'];
42
    }
43
}
44