Passed
Push — master ( b97787...c0f601 )
by Jean-Christophe
16:10
created

Url   A

Complexity

Total Complexity 14

Size/Duplication

Total Lines 112
Duplicated Lines 0 %

Test Coverage

Coverage 85.71%

Importance

Changes 0
Metric Value
wmc 14
eloc 29
dl 0
loc 112
ccs 36
cts 42
cp 0.8571
rs 10
c 0
b 0
f 0

14 Methods

Rating   Name   Duplication   Size   Complexity  
A getValid() 0 2 1
A getLastModified() 0 2 1
A setValid() 0 2 1
A __construct() 0 7 1
A getExisting() 0 2 1
A setChangeFrequency() 0 2 1
A getLocation() 0 2 1
A setLocation() 0 2 1
A setExisting() 0 2 1
A fromArray() 0 5 1
A getChangeFrequency() 0 2 1
A setPriority() 0 2 1
A setLastModified() 0 2 1
A getPriority() 0 2 1
1
<?php
2
3
namespace Ubiquity\seo;
4
5
use Ubiquity\utils\http\URequest;
6
7
/**
8
 * Url for Seo module, use for sitemap generation
9
 * @author jc
10
 *
11
 */
12
class Url {
13
	private $location;
14
	private $lastModified;
15
	private $changeFrequency;
16
	private $priority;
17
	private $existing;
18
	private $valid;
19
20 1
	public function __construct($location="", $lastModified=null, $changeFrequency="daily", $priority="0.5") {
21 1
		$this->location=$location;
22 1
		$this->lastModified=$lastModified;
23 1
		$this->changeFrequency=$changeFrequency;
24 1
		$this->priority=$priority;
25 1
		$this->existing=false;
26 1
		$this->valid=true;
27 1
	}
28
29
	/**
30
	 *
31
	 * @return mixed
32
	 */
33 1
	public function getLocation() {
34 1
		return $this->location;
35
	}
36
37
	/**
38
	 *
39
	 * @return string
40
	 */
41
	public function getLastModified() {
42
		return $this->lastModified;
43
	}
44
45
	/**
46
	 *
47
	 * @return string
48
	 */
49 1
	public function getChangeFrequency() {
50 1
		return $this->changeFrequency;
51
	}
52
53
	/**
54
	 *
55
	 * @return string
56
	 */
57 1
	public function getPriority() {
58 1
		return $this->priority;
59
	}
60
61
	/**
62
	 *
63
	 * @param mixed $location
64
	 */
65 1
	public function setLocation($location) {
66 1
		$this->location=$location;
67 1
	}
68
69
	/**
70
	 *
71
	 * @param string $lastModified
72
	 */
73 1
	public function setLastModified($lastModified) {
74 1
		$this->lastModified=$lastModified;
75 1
	}
76
77
	/**
78
	 *
79
	 * @param string $changeFrequency
80
	 */
81 1
	public function setChangeFrequency($changeFrequency) {
82 1
		$this->changeFrequency=$changeFrequency;
83 1
	}
84
85
	/**
86
	 *
87
	 * @param string $priority
88
	 */
89 1
	public function setPriority($priority) {
90 1
		$this->priority=$priority;
91 1
	}
92
	/**
93
	 * @return mixed
94
	 */
95 1
	public function getExisting() {
96 1
		return $this->existing;
97
	}
98
99
	/**
100
	 * @param mixed $existing
101
	 */
102 1
	public function setExisting($existing) {
103 1
		$this->existing = $existing;
104 1
	}
105
106 1
	public static function fromArray($array,$existing=true){
107 1
		$array["existing"]=$existing;
108 1
		$object=new Url();
109 1
		URequest::setValuesToObject($object,$array);
110 1
		return $object;
111
	}
112
	/**
113
	 * @return boolean
114
	 */
115
	public function getValid() {
116
		return $this->valid;
117
	}
118
119
	/**
120
	 * @param boolean $valid
121
	 */
122
	public function setValid($valid) {
123
		$this->valid = $valid;
124
	}
125
126
127
}
128
129