/** * @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]); }
public function __construct(PatternInterface $pattern, $variant, $dataFile) { $this->pattern = $pattern; $this->variant = $variant; $this->path = $pattern->getPath() . "~{$variant}"; $this->id = $this->path; $this->name = $pattern->getName() . ' ' . str_replace('-', ' ', $variant); $this->dataFiles = [$dataFile]; }
public function addPattern(\Labcoat\Patterns\PatternInterface $pattern) { $path = explode(DIRECTORY_SEPARATOR, $pattern->getPath()); if (count($path) > 2) { $this->getSubtype($path[1])->addPattern($pattern); } else { $this->patterns[$pattern->getSlug()] = new Pattern($pattern); foreach ($pattern->getPseudoPatterns() as $pseudo) { $this->patterns[$pseudo->getSlug()] = new Pattern($pseudo); } ksort($this->patterns); } }
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"); } }
public function addPattern(PatternInterface $pattern) { $this->items[$pattern->getSlug()] = $pattern; }
public function makePath(SourcePattern $pattern) { $path = Navigation::escapePath($pattern->getPath()); return PatternLab::makePath([$path, "{$path}.html"]); }
protected function makePaths(SourcePatternInterface $pattern) { $path = preg_replace('|[\\\\/~]|', '-', $pattern->getPath()); $this->escapedSourcePath = PatternLab::makePath(['patterns', $path, "{$path}.escaped.html"]); $this->path = PatternLab::makePath([$path, "{$path}.html"]); $this->pagePath = PatternLab::makePath(['patterns', $this->path]); $this->sourcePath = PatternLab::makePath(['patterns', $path, "{$path}.pattern.html"]); $this->templatePath = PatternLab::makePath(['patterns', $path, "{$path}.twig"]); $this->lineagePath = PatternLab::makePath(['..', '..', $this->pagePath]); }