Example #1
0
 /**
  * Get method info from class
  *
  * @param string $method
  *
  * @return MethodInfo|bool
  */
 public function getMethod($method)
 {
     if (isset($this->methods[$method])) {
         return $this->methods[$method];
     } elseif (method_exists($this->name, $method)) {
         return $this->methods[$method] = MethodInfo::scan($this->name, $method);
     } else {
         return false;
     }
 }
Example #2
0
 private function getParameters(MethodInfo $methodInfo)
 {
     $params = [];
     foreach ($methodInfo->getParameters() as $param) {
         $p = '$' . $param->getName();
         if ($param->isByReference()) {
             $p = '&' . $p;
         }
         if ($param->isVariadic()) {
             $p = '...' . $p;
         }
         if ($param->hasTypeDeclaration()) {
             $type = $param->getTypeDeclaration();
             $this->setClassAlias($type);
             $p = $type['alias'] . ' ' . $p;
         }
         if ($param->hasDefaultValue()) {
             $p .= ' = ' . $this->varExport($param->getDefaultValue());
         }
         $params[] = $p;
     }
     return implode(', ', $params);
 }