TheSeer\phpDox\Collector\Project::addFile PHP Method

addFile() public method

public addFile ( TheSeer\phpDox\Collector\SourceFile $file ) : boolean
$file TheSeer\phpDox\Collector\SourceFile
return boolean
    public function addFile(SourceFile $file)
    {
        $isNew = $this->source->addFile($file);
        if ($isNew) {
            $this->removeFileReferences($file->getPathname());
            $this->files[$file->getPathname()] = $file;
        }
        return $isNew;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * @param DirectoryScanner $scanner
  *
  * @return Project
  */
 public function run(DirectoryScanner $scanner)
 {
     $srcDir = $this->project->getSourceDir();
     $this->logger->log("Scanning directory '{$srcDir}' for files to process\n");
     $iterator = new SourceFileIterator($scanner($srcDir), $srcDir);
     foreach ($iterator as $file) {
         $needsProcessing = $this->project->addFile($file);
         if (!$needsProcessing) {
             $this->logger->progress('cached');
             continue;
         }
         if (!$this->processFile($file)) {
             $this->project->removeFile($file);
         }
     }
     $this->logger->completed();
     return $this->project;
 }