/** * @return array */ private function delocalizePath() { $this->assertUrlExists(); if (!isset($this->parsed['path'])) { return null; } $path_segments = explode('/', trim($this->parsed['path'], '/')); if (count($path_segments) < 1) { return null; } if ($path_segments[0] == $this->locale->getSlug($path_segments[0]) || $this->locale->isHidden($path_segments[0])) { unset($path_segments[0]); } return '/' . implode('/', $path_segments); }
/** * @param $parsed * @return array */ private function cleanPathFromExistingLocale($parsed) { if (!isset($parsed['path'])) { return null; } $path_segments = explode('/', trim($parsed['path'], '/')); if (count($path_segments) < 1) { return null; } if ($path_segments[0] == $this->locale->getSlug($path_segments[0]) || $this->locale->isHidden($path_segments[0])) { unset($path_segments[0]); } return '/' . implode('/', $path_segments); }