Example #1
0
 public function makePartial(SourcePattern $pattern)
 {
     $path = explode('/', $pattern->getNormalizedPath());
     $type = array_shift($path);
     $name = Navigation::escapePath(array_pop($path));
     return implode('-', [$type, $name]);
 }
Example #2
0
 /**
  * @param PatternInterface $pattern
  */
 protected function addPatternPath(SourcePattern $pattern)
 {
     $path = explode('/', $pattern->getNormalizedPath());
     $type = array_shift($path);
     $name = $this->escapePath(array_pop($path));
     $this->patternPaths[$type][$name] = $this->makeItemPath($pattern);
     ksort($this->patternPaths[$type]);
 }
Example #3
0
 public function addPattern(PatternInterface $pattern)
 {
     $keys = explode('/', $pattern->getNormalizedPath());
     switch (count($keys)) {
         case 3:
             $subtype = dirname($pattern->getPath());
             $this->getOrCreateSubtype($subtype)->addPattern($pattern);
             break;
         case 2:
             $this->items[$keys[1]] = $pattern;
             break;
         default:
             throw new \InvalidArgumentException("Invalid path");
     }
 }