Esempio n. 1
0
 /**
  * @param string $string The string to parse
  */
 public function __construct($string)
 {
     $string = preg_replace(self::COMMENT_PATTERN, '', $string);
     preg_match_all('/' . ClassObject::PATTERN . '/i', $string, $classMatches, PREG_SET_ORDER);
     foreach ($classMatches as $classMatch) {
         $name = $classMatch[ClassObject::PATTERN_NAME_GROUP];
         $class = $this->getClass($name);
         if ($class === null) {
             $this->classes[] = new ClassObject($classMatch[0]);
         } else {
             $this->replaceClass($name, new ClassObject($classMatch[0], $class));
         }
     }
     preg_match_all(Association::getPattern(), $string, $associationMatches, PREG_SET_ORDER);
     foreach ($associationMatches as $associationMatch) {
         $this->associations[] = new Association($associationMatch[0]);
     }
 }