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

save() public method

public save ( ) : array
return array
    public function save()
    {
        try {
            $map = $this->initDirectories();
            $indexDom = $this->index->export();
            $reportUnits = $this->saveUnits;
            foreach ($this->saveUnits as $unit) {
                $reportUnits = $this->saveUnit($map, $reportUnits, $unit);
            }
            $indexDom->formatOutput = TRUE;
            $indexDom->preserveWhiteSpace = FALSE;
            $indexDom->save($this->xmlDir . '/index.xml');
            $this->saveSources();
            $this->saveUnits = array();
            $this->files = array();
            return $reportUnits;
        } catch (\Exception $e) {
            throw new ProjectException(sprintf('An error occured while saving the collected data: %s', $e->getMessage()), ProjectException::ErrorWhileSaving, $e);
        }
    }

Usage Example

Exemplo n.º 1
0
 /**
  * @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();
 }