Phan\Phan::isExcludedAnalysisFile PHP Method

isExcludedAnalysisFile() private static method

private static isExcludedAnalysisFile ( string $file_path ) : boolean
$file_path string
return boolean True if this file is a member of a third party directory as configured via the CLI flag '-3 [paths]'.
    private static function isExcludedAnalysisFile(string $file_path) : bool
    {
        foreach (Config::get()->exclude_analysis_directory_list as $directory) {
            if (0 === strpos($file_path, $directory) || 0 === strpos($file_path, "./{$directory}")) {
                return true;
            }
        }
        return false;
    }

Usage Example

Example #1
0
File: Log.php Project: actank/phan
 /**
  * @param int $category
  * The category of error such as `Issue::CATEGORY_UNDEFINED`
  *
  * @param string $type
  * The error type such as `Issue::UndeclaredMethod`
  *
  * @param int $severity
  * The severity of the issue such as `Issue::SEVERITY_NORMAL`
  *
  * @param string $message
  * The error message
  *
  * @param string $file
  * The name of the file with the issue
  *
  * @param int $lineno
  * The line number where the issue occurs
  */
 public static function err(int $category, string $type, int $severity, string $message, string $file, int $lineno)
 {
     $log = self::getInstance();
     // Don't report anything for excluded files
     if (Phan::isExcludedAnalysisFile($file)) {
         return;
     }
     // Don't report anything below our minimum severity
     // threshold
     if ($severity < Config::get()->minimum_severity) {
         return;
     }
     if ($category & $log->output_mask) {
         // This needs to be a sortable key so that output
         // is in the expected order
         $ukey = implode('|', [$file, str_pad((string) $lineno, 5, '0', STR_PAD_LEFT), $type, $message]);
         $log->msgs[$ukey] = ['file' => $file, 'lineno' => $lineno, 'category' => $category, 'type' => $type, 'severity' => $severity, 'message' => $message];
     }
 }
All Usage Examples Of Phan\Phan::isExcludedAnalysisFile