Skip to content

Commit 348b352

Browse files
committed
use ternary and del error
1 parent f67e12e commit 348b352

1 file changed

Lines changed: 7 additions & 26 deletions

File tree

system/HTTP/URI.php

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -711,14 +711,8 @@ public function setPath(string $path)
711711
$this->path = $this->filterPath($path);
712712

713713
$tempPath = trim($this->path, '/');
714-
if ($tempPath === '')
715-
{
716-
$this->segments = [];
717-
}
718-
else
719-
{
720-
$this->segments = explode('/', $tempPath);
721-
}
714+
715+
$this->segments = ($tempPath === '') ? [] : explode('/', $tempPath);
722716

723717
return $this;
724718
}
@@ -735,15 +729,8 @@ public function refreshPath()
735729
$this->path = $this->filterPath(implode('/', $this->segments));
736730

737731
$tempPath = trim($this->path, '/');
738-
if ($tempPath === '')
739-
{
740-
$this->segments = [];
741-
}
742-
else
743-
{
744-
$this->segments = explode('/', $tempPath);
745-
}
746-
$this->segments = explode('/', trim($this->path, '/'));
732+
733+
$this->segments = ($tempPath === '') ? [] : explode('/', $tempPath);
747734

748735
return $this;
749736
}
@@ -977,15 +964,9 @@ protected function applyParts(array $parts)
977964
// Populate our segments array
978965
if (isset($parts['path']) && $parts['path'] !== '')
979966
{
980-
$path = trim($parts['path'], '/');
981-
if ($path === '')
982-
{
983-
$this->segments = [];
984-
}
985-
else
986-
{
987-
$this->segments = explode('/', $path);
988-
}
967+
$tempPath = trim($parts['path'], '/');
968+
969+
$this->segments = ($tempPath === '') ? [] : explode('/', $tempPath);
989970
}
990971
}
991972

0 commit comments

Comments
 (0)