ApiGen\Utils\FileSystem::getAbsolutePath PHP Метод

getAbsolutePath() публичный метод

public getAbsolutePath ( string $path, array $baseDirectories = [] ) : string
$path string
$baseDirectories array
Результат string
    public function getAbsolutePath($path, array $baseDirectories = [])
    {
        foreach ($baseDirectories as $directory) {
            $fileName = $directory . '/' . $path;
            if (is_file($fileName)) {
                return self::normalizePath(realpath($fileName));
            }
        }
        if (file_exists($path)) {
            $path = realpath($path);
        }
        return self::normalizePath($path);
    }

Usage Example

 private function setNormalizers()
 {
     $this->resolver->setNormalizer(CO::ANNOTATION_GROUPS, function (Options $options, $value) {
         $value = (array) $value;
         if ($options[CO::DEPRECATED]) {
             $value[] = CO::DEPRECATED;
         }
         if ($options[CO::TODO]) {
             $value[] = CO::TODO;
         }
         return array_unique($value);
     });
     $this->resolver->setNormalizer(CO::DESTINATION, function (Options $options, $value) {
         return $this->fileSystem->getAbsolutePath($value);
     });
     $this->resolver->setNormalizer(CO::BASE_URL, function (Options $options, $value) {
         return rtrim($value, '/');
     });
     $this->resolver->setNormalizer(CO::SOURCE, function (Options $options, $value) {
         if (!is_array($value)) {
             $value = [$value];
         }
         foreach ($value as $key => $source) {
             $value[$key] = $this->fileSystem->getAbsolutePath($source);
         }
         return $value;
     });
     $this->resolver->setNormalizer(CO::SOURCE_CODE, function (Options $options) {
         return !$options[CO::NO_SOURCE_CODE];
     });
     $this->resolver->setNormalizer(CO::TEMPLATE_CONFIG, function (Options $options, $value) {
         return $this->fileSystem->getAbsolutePath($value);
     });
 }