ApiGen\Generator\Resolvers\RelativePathResolver::getRelativePath PHP 메소드

getRelativePath() 공개 메소드

public getRelativePath ( string $fileName ) : string
$fileName string
리턴 string
    public function getRelativePath($fileName)
    {
        foreach ($this->configuration->getOption(CO::SOURCE) as $directory) {
            if (strpos($fileName, $directory) === 0) {
                return $this->getFileNameWithoutSourcePath($fileName, $directory);
            }
        }
        throw new InvalidArgumentException(sprintf('Could not determine "%s" relative path', $fileName));
    }

Usage Example

예제 #1
0
 private function generateForElement(ElementReflectionInterface $element)
 {
     $template = $this->templateFactory->createNamedForElement('source', $element);
     $template = $this->namespaceAndPackageLoader->loadTemplateWithElementNamespaceOrPackage($template, $element);
     $template->setParameters(['fileName' => $this->relativePathResolver->getRelativePath($element->getFileName()), 'source' => $this->getHighlightedCodeFromElement($element)]);
     $template->save();
 }
All Usage Examples Of ApiGen\Generator\Resolvers\RelativePathResolver::getRelativePath