-
Notifications
You must be signed in to change notification settings - Fork 0
/
XmlSetting.php
60 lines (52 loc) · 1.37 KB
/
XmlSetting.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
/**
* Created by IntelliJ IDEA.
* User: Mattias Kågström
* Date: 2017-04-04
* Time: 11:21
*/
class XmlSetting
{
private $fileLocation, $regexp, $replaceWith, $id, $friendlyName;
public function __construct($id, $fileLocation, $regexp, $replaceWith, $friendlyName)
{
$this->id = $id;
$this->fileLocation=$fileLocation;
$this->regexp = $regexp;
$this->replaceWith = $replaceWith;
$this->friendlyName = $friendlyName;
}
/**
* @return mixed
*/
public function getFileLocation()
{
return $this->fileLocation;
}
/**
* @return mixed
*/
public function getRegexp()
{
return $this->regexp;
}
/**
* @return mixed
*/
public function getReplaceWith()
{
return $this->replaceWith;
}
public function getObject(){
$array["id"] = $this->id;
$array["fileLocation"] = $this->fileLocation;
$array["regexp"] = $this->regexp;
$array["replaceWith"] = $this->replaceWith;
$array["name"] = $this->friendlyName;
return $array;
}
public function replaceVariable($varName, $newValue, $variable){
$this->fileLocation = str_replace("{%" . $varName . "%}",$newValue,$this->query);
$this->replaceWith = str_replace("{%" . $varName . "%}",$newValue,$this->dblocation);
}
}