Phan\Config::projectPath PHP Method

projectPath() public static method

public static projectPath ( string $relative_path ) : string
$relative_path string
return string The relative path appended to the project root directory.
    public static function projectPath(string $relative_path)
    {
        // Make sure its actually relative
        if (DIRECTORY_SEPARATOR == substr($relative_path, 0, 1)) {
            return $relative_path;
        }
        return implode(DIRECTORY_SEPARATOR, [Config::get()->getProjectRootDirectory(), $relative_path]);
    }

Usage Example

Beispiel #1
0
Datei: CLI.php Projekt: etsy/phan
 /**
  * @param string $directory_name
  * The name of a directory to scan for files ending in `.php`.
  *
  * @return string[]
  * A list of PHP files in the given directory
  */
 private function directoryNameToFileList(string $directory_name) : array
 {
     $file_list = [];
     try {
         $iterator = new \RegexIterator(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($directory_name, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS)), '/^.+\\.php$/i', \RecursiveRegexIterator::GET_MATCH);
         foreach (array_keys(iterator_to_array($iterator)) as $file_name) {
             $file_path = Config::projectPath($file_name);
             if (is_file($file_path) && is_readable($file_path)) {
                 $file_list[] = $file_name;
             } else {
                 error_log("Unable to read file {$file_path}");
             }
         }
     } catch (\Exception $exception) {
         error_log($exception->getMessage());
     }
     return $file_list;
 }
All Usage Examples Of Phan\Config::projectPath