getDeclaringClass() public method

public getDeclaringClass ( ) : ClassType
return ClassType
Esempio n. 1
0
 /**
  * @param Method $method
  * @param $secured
  * @return null|string
  */
 protected function getSchemaOfResource(Method $method, $secured)
 {
     $ret = isset($secured['resource']) ? $secured['resource'] : NULL;
     if (!$ret) {
         $s = $method->getDeclaringClass()->getAnnotation('secured');
         $ret = isset($s['resource']) ? $s['resource'] : $method->getDeclaringClass()->getName();
     }
     return $ret;
 }
Esempio n. 2
0
 /**
  * Creates method list
  * (may take a time..)
  *
  * @return array
  */
 public function createMethodList()
 {
     /** @var $robotLoader RobotLoader */
     $robotLoader = $this->context->getService('robotLoader');
     foreach ($robotLoader->getIndexedClasses() as $class => $file) {
         if (Strings::match($file, "~\\Nette~")) {
             continue;
         }
         $creflection = new Nette\Reflection\ClassType($class);
         foreach ($creflection->getMethods() as $method) {
             $mreflection = new Method($class, $method->getName());
             if ($mreflection->hasAnnotation('cron')) {
                 $m = new stdClass();
                 $m->name = $mreflection->getName();
                 $m->class = $mreflection->getDeclaringClass()->getName();
                 $m->annotations = $mreflection->getAnnotations();
                 $this->methods[] = $m;
             }
         }
     }
     return $this->methods;
 }
Esempio n. 3
0
 /**
  * Parse cronner values from annotations.
  *
  * @param \Nette\Reflection\Method $method
  * @return array
  */
 public static function parseParameters(Method $method)
 {
     $taskName = NULL;
     if ($method->hasAnnotation(Parameters::TASK)) {
         $className = $method->getDeclaringClass()->getName();
         $methodName = $method->getName();
         $taskName = $className . ' - ' . $methodName;
     }
     $parameters = array(static::TASK => Parser::parseName($method->getAnnotation(Parameters::TASK)) ?: $taskName, static::PERIOD => $method->hasAnnotation(Parameters::PERIOD) ? Parser::parsePeriod($method->getAnnotation(Parameters::PERIOD)) : NULL, static::DAYS => $method->hasAnnotation(Parameters::DAYS) ? Parser::parseDays($method->getAnnotation(Parameters::DAYS)) : NULL, static::TIME => $method->hasAnnotation(Parameters::TIME) ? Parser::parseTimes($method->getAnnotation(Parameters::TIME)) : NULL);
     return $parameters;
 }