Skip to content

Commit d6aa8cf

Browse files
author
arutyunyan
committed
refactor
1 parent 97f7775 commit d6aa8cf

File tree

3 files changed

+21
-16
lines changed

3 files changed

+21
-16
lines changed

src/dom/Dom.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,20 @@ class Dom
1212
/**
1313
* @var array
1414
*/
15-
private $variableList = [];
15+
private $variables = [];
1616
/**
1717
* Добавляет переменную
1818
* @param Variable $variable
1919
*/
2020
public function addVariable(Variable $variable)
2121
{
22-
$this->variableList[] = $variable;
22+
$this->variables[$variable->getName()] = $variable;
23+
}
24+
/**
25+
* @return array
26+
*/
27+
public function getVariables()
28+
{
29+
return $this->variables;
2330
}
2431
}

src/dom/Path.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ class Path
1616
/**
1717
* @var string
1818
*/
19-
private $format;
19+
public $format;
2020
/**
2121
* @var string
2222
*/
23-
private $template;
23+
public $template;
2424
/**
2525
* @Constructor
2626
*/
@@ -30,4 +30,11 @@ function __construct($path, $format = 'raw', $template = null)
3030
$this->format = $format;
3131
$this->template = $template;
3232
}
33+
/**
34+
* @return string
35+
*/
36+
public function getPath()
37+
{
38+
return $this->path;
39+
}
3340
}

src/dom/Variable.php

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ class Variable
1616
/**
1717
* @var mixed значение
1818
*/
19-
private $value;
19+
public $value;
2020
/**
2121
* @var array пути в шаблоне
2222
*/
23-
private $pathList = [];
23+
public $paths = [];
2424
/**
2525
* Constructor
2626
* @param string $name имя переменной
@@ -30,7 +30,6 @@ function __construct($name)
3030
$this->name = $name;
3131
}
3232
/**
33-
* Получает имя переменной
3433
* @return string
3534
*/
3635
public function getName()
@@ -45,19 +44,11 @@ public function setValue($value)
4544
{
4645
$this->value = $value;
4746
}
48-
/**
49-
* Получает значение
50-
* @return mixed
51-
*/
52-
public function getValue()
53-
{
54-
return $this->value;
55-
}
5647
/**
5748
* Добавляет путь
5849
*/
5950
public function addPath(Path $path)
6051
{
61-
$this->pathList[] = $path;
52+
$this->paths[$path->getPath()] = $path;
6253
}
6354
}

0 commit comments

Comments
 (0)