Completed
Push — master ( c48ac2...909c9d )
by Tim
14:12
created

GeoNode   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getFormat() 0 4 1
A setFormat() 0 16 2
1
<?php
2
3
/**
4
 * Sitemap Geo node
5
 */
6
7
namespace FRUIT\GoogleServices\Domain\Model\Node;
8
9
use FRUIT\GoogleServices\Domain\Model\AbstractModel;
10
use TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentValueException;
11
12
/**
13
 * Sitemap Geo
14
 */
15
class GeoNode extends AbstractModel
16
{
17
18
    /**
19
     * The Geo format: kml, kmz or georss
20
     *
21
     * @var string
22
     */
23
    protected $format;
24
25
    /**
26
     * Get format
27
     *
28
     * @return string
29
     */
30
    public function getFormat()
31
    {
32
        return $this->format;
33
    }
34
35
    /**
36
     * Set format
37
     *
38
     * @param string $format
39
     *
40
     * @throws InvalidArgumentValueException
41
     */
42
    public function setFormat($format)
43
    {
44
        $format = strtolower($format);
45
        if (!in_array($format, [
46
            'kml',
47
            'kmz',
48
            'georss'
49
        ])
50
        ) {
51
            throw new InvalidArgumentValueException(
52
                '$format have to be kml, kmz or georss',
53
                23479823479283
54
            );
55
        }
56
        $this->format = $format;
57
    }
58
}
59