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

addFile() public method

public addFile ( TheSeer\phpDox\Collector\SourceFile $file )
$file TheSeer\phpDox\Collector\SourceFile
    public function addFile(SourceFile $file)
    {
        $path = $file->getRealPath();
        $node = $this->workDom->createElementNS('http://xml.phpdox.net/src', 'file');
        $node->setAttribute('name', basename($file->getBasename()));
        $node->setAttribute('size', $file->getSize());
        $node->setAttribute('time', date('c', $file->getMTime()));
        $node->setAttribute('unixtime', $file->getMTime());
        $node->setAttribute('sha1', sha1_file($file->getPathname()));
        $this->collection[$path] = $node;
        $changed = $this->isChanged($path);
        if (!$changed) {
            $node->setAttribute('xml', $this->original[$path]->getAttribute('xml'));
        }
        return $changed;
    }

Usage Example

Example #1
0
 /**
  * @param FileInfo $file
  * @return bool
  */
 public function addFile(FileInfo $file) {
     $isNew = $this->source->addFile($file);
     if ($isNew) {
         $this->removeFileReferences($file->getPathname());
     }
     return $isNew;
 }
All Usage Examples Of TheSeer\phpDox\Collector\SourceCollection::addFile