示例#1
0
 /**
  * @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);
 }
示例#2
0
 /**
  * @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);
 }