protected function parseUse($match) { $use = new TUse(); if (strpos($match, ' as ') !== false) { //Using alias $parts = explode(' as ', $match); $use->setClass($parts[0]); $use->setAlias($parts[1]); } else { preg_match("/.+\\\\(.+)/", $match, $matches); //get the class name, it becomes alias $alias = $matches[1]; $use->setClass($match); $use->setAlias($alias); } $this->class->addUse($use); }
public function addUse(TUse $use) { $this->uses[$use->getAlias()] = $use; }