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

GeoNode::setFormat()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 16
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

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