Passed
Push — master ( 896e22...61bd56 )
by Dāvis
03:36
created

SitemapIndex::getLoc()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Sludio\HelperBundle\Sitemap\Entity;
4
5
class SitemapIndex
6
{
7
    protected $loc = null;
8
    protected $lastmod = null;
9
    protected $urlCount = 0;
10
11 View Code Duplication
    public function setLoc($loc)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
12
    {
13
        if (strlen($loc) > 2048) {
14
            throw new \DomainException('The loc value must be less than 2,048 characters');
15
        }
16
17
        $this->loc = $loc;
18
19
        return $this;
20
    }
21
22
    public function getLoc()
23
    {
24
        return $this->loc;
25
    }
26
27 View Code Duplication
    public function setLastmod($lastmod)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
28
    {
29
        if ($lastmod !== null && !$lastmod instanceof \DateTime) {
30
            $lastmod = new \DateTime($lastmod);
31
        }
32
33
        $this->lastmod = $lastmod;
34
35
        return $this;
36
    }
37
38
    public function getLastmod()
39
    {
40
        if ($this->lastmod === null) {
41
            return null;
42
        }
43
44
        return $this->lastmod->format(\DateTime::W3C);
45
    }
46
47
    public function incrementUrl()
48
    {
49
        $this->urlCount++;
50
    }
51
52
    public function getUrlCount()
53
    {
54
        return $this->urlCount;
55
    }
56
}