コード例 #1
0
ファイル: UML.php プロジェクト: altesien/FinalProject
 /**
  * Parse the directories and the files (depending on what the $directories
  * and $files properties have been set to with setInput()) and return a
  * UML model.
  *
  * @param string $modelName A model name (e.g., the name of your application)
  * 
  * @return PHP_UML_Metamodel_Superstructure The resulting UML model
  */
 public function parse($modelName = 'default')
 {
     $this->model->initModel($modelName);
     if ($this->importer instanceof PHP_UML_Input_PHP_FileScanner) {
         $this->setInputPhpParserOptions();
     }
     $this->importer->setFiles($this->files);
     $this->importer->setDirectories($this->directories);
     $this->importer->setMatchPatterns($this->matchPatterns);
     $this->importer->setIgnorePatterns($this->ignorePatterns);
     $this->importer->import();
     if ($this->removeEmptyNamespaces) {
         PHP_UML_Metamodel_Helper::deleteEmptyPackages($this->model->packages);
     }
     return $this->model;
 }
コード例 #2
0
 /**
  * Finalizes the main object structure that the Parser has built.
  * Launches the resolution of the references for all stacks from the root pkg
  * 
  * Every reference (a temporary string) is replaced by a PHP reference
  * to the corresponding type (that is, a class or a datatype)
  * Must be run once the model is complete (= once PHP parsing is done)
  * 
  * @param bool  $noEmptyPkg True to force removal of empty packages
  * @param array $defPkg     Array of PHP_UML_Metamodel_Package where to look into,
  *                          in order to resolve the orphaned elements.
  *                          By default, it will look in the root package. This is,
  *                          by the way, where the PHP datatypes are.
  */
 public function finalizeAll($noEmptyPkg = true, $defPkg = array())
 {
     if ($noEmptyPkg) {
         PHP_UML_Metamodel_Helper::deleteEmptyPackages($this->packages);
     }
     $resolver = new PHP_UML_Metamodel_TypeResolverByName();
     $resolver->package = $this->packages;
     if (empty($defPkg)) {
         $defPkg = array($this->packages);
     } else {
         $defPkg[] =& $this->packages;
     }
     $resolver->resolveReferences($this->packages, $defPkg);
 }