/** * @param array $changed * @param Project $project * @param InheritanceConfig $config * * @throws ProjectException * @throws UnitObjectException */ public function resolve(array $changed, Project $project, InheritanceConfig $config) { if (count($changed) == 0) { return; } $this->logger->reset(); $this->logger->log("Resolving inheritance\n"); $this->project = $project; $this->config = $config; $this->setupDependencies(); foreach ($changed as $unit) { /** @var AbstractUnitObject $unit */ if ($unit->hasExtends()) { foreach ($unit->getExtends() as $name) { try { $extendedUnit = $this->getUnitByName($name); $this->processExtends($unit, $extendedUnit); } catch (ProjectException $e) { $this->addUnresolved($unit, $name); } } } if ($unit->hasImplements()) { foreach ($unit->getImplements() as $implements) { try { $implementsUnit = $this->getUnitByName($implements); $this->processImplements($unit, $implementsUnit); } catch (ProjectException $e) { $this->addUnresolved($unit, $implements); } } } if ($unit->usesTraits()) { foreach ($unit->getUsedTraits() as $traitName) { try { $traitUnit = $this->getUnitByName($traitName); $this->processTraitUse($unit, $unit->getTraitUse($traitName), $traitUnit); } catch (ProjectException $e) { $this->addUnresolved($unit, $traitName); } } } $unitName = $unit->getName(); if (isset($this->unresolved[$unitName])) { foreach ($this->unresolved[$unitName] as $missingUnit) { $unit->markDependencyAsUnresolved($missingUnit); } } $this->logger->progress('processed'); } $this->project->save(); $this->logger->completed(); }
/** * @param Project $project * @param bool $publicOnly */ public function run(Project $project, $publicOnly = FALSE) { $this->xmlDir = $project->getXmlDir(); $this->publicOnly = $publicOnly; $this->project = $project; $this->handleEvent(new PHPDoxStartEvent($project->getIndex(), $project->getSourceTree())); if ($this->project->hasNamespaces()) { $this->processWithNamespace(); } else { $this->processGlobalOnly(); } $this->handleEvent(new PHPDoxEndEvent($project->getIndex(), $project->getSourceTree())); $this->logger->completed(); }
/** * @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; }