Оптимизации и исправления топов.
This commit is contained in:
parent
77fa3dbd5e
commit
0f4b2fb722
25 changed files with 109 additions and 53 deletions
19
src/Path.php
19
src/Path.php
|
|
@ -160,8 +160,9 @@ class Path
|
|||
// Сравнение двух путей на равентство
|
||||
public function equal(/*.Path.*/ $path)
|
||||
{
|
||||
if (count($this->path) == count($path->path)) {
|
||||
for ($i = 0; $i < count($this->path); $i++) {
|
||||
$count = count($this->path);
|
||||
if ($count == count($path->path)) {
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
if ($this->path[$i] != $path->path[$i]) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -207,8 +208,9 @@ class Path
|
|||
if (isset($this->url['host']) && isset($path->url['host'])
|
||||
&& ($this->url['host'] != $path->url['host'])) return false;
|
||||
|
||||
if (count($path->path) > count($this->path)) {
|
||||
for ($i = 0; $i < count($this->path); $i++) {
|
||||
$count = count($this->path);
|
||||
if (count($path->path) > $count) {
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
if ($path->path[$i] != $this->path[$i]) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -252,15 +254,18 @@ class Path
|
|||
$list_path = $list->getParts();
|
||||
|
||||
$result = array();
|
||||
for ($i = 0; $i < count($list_path); $i++) {
|
||||
$count = count($list_path);
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
if (($i >= count($self_path)) || $list_path[$i] != $self_path[$i]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
for($j = $i; $j < count($list_path); $j++) {
|
||||
$list_count = count($list_path);
|
||||
for($j = $i; $j < $list_count; $j++) {
|
||||
array_push($result, '..');
|
||||
}
|
||||
for($j = $i; $j < count($self_path); $j++) {
|
||||
$self_count = count($self_path);
|
||||
for($j = $i; $j < $self_count; $j++) {
|
||||
array_push($result, $self_path[$j]);
|
||||
}
|
||||
return implode("/", $result);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue