Example #1
0
 /**
  * Return class name from token
  *
  * @param int $staticCall
  * @return string
  */
 protected function getClassByStaticCall($staticCall)
 {
     $step = 1;
     $staticClassParts = [];
     while ($this->tokens->getTokenCodeByKey($staticCall - $step) == T_STRING || $this->tokens->getTokenCodeByKey($staticCall - $step) == T_NS_SEPARATOR) {
         $staticClassParts[] = $this->tokens->getTokenValueByKey($staticCall - $step);
         $step++;
     }
     return implode(array_reverse($staticClassParts));
 }
Example #2
0
 /**
  * @inheritdoc
  */
 public function getDependencies(Uses $uses)
 {
     foreach ($this->throws as $throw) {
         $class = '';
         if ($this->tokens->getTokenCodeByKey($throw + 2) == T_NEW) {
             $step = 4;
             while ($this->tokens->getTokenCodeByKey($throw + $step) == T_STRING || $this->tokens->getTokenCodeByKey($throw + $step) == T_NS_SEPARATOR) {
                 $class .= trim($this->tokens->getTokenValueByKey($throw + $step));
                 $step++;
             }
             if ($uses->hasUses()) {
                 $class = $uses->getClassNameWithNamespace($class);
             }
             $this->dependencies[] = $class;
         }
     }
     return $this->dependencies;
 }