Esempio n. 1
0
 /**
  * Gets the annotations applied to a method.
  * 
  * @param string|ReflectionClass $class The name or ReflectionClass of the class that owns the method.
  * @param string|ReflectionMethod $property The name or ReflectionMethod of the method from which
  * the annotations should be read.
  * @return array An array of Annotations.
  */
 public function getMethodAnnotations(ReflectionMethod $method)
 {
     $cacheKey = $method->getDeclaringClass()->getName() . '#' . $method->getName() . self::$CACHE_SALT;
     if ($this->_cache->contains($cacheKey)) {
         return $this->_cache->fetch($cacheKey);
     }
     $context = "method " . $method->getDeclaringClass()->getName() . "::" . $method->getName() . "()";
     $annotations = $this->_parser->parse($method->getDocComment(), $context);
     $this->_cache->save($cacheKey, $annotations, null);
     return $annotations;
 }
 /**
  * Gets the annotations applied to a method.
  * 
  * @param ReflectionMethod $property The name or ReflectionMethod of the method from which
  * the annotations should be read.
  * @return array An array of Annotations.
  */
 public function getMethodAnnotations(ReflectionMethod $method)
 {
     $cacheKey = $method->getDeclaringClass()->getName() . '#' . $method->getName() . self::$CACHE_SALT;
     // Attempt to grab data from cache
     if (($data = $this->cache->fetch($cacheKey)) !== false) {
         return $data;
     }
     $context = 'method ' . $method->getDeclaringClass()->getName() . '::' . $method->getName() . '()';
     $annotations = $this->parser->parse($method->getDocComment(), $context);
     $this->cache->save($cacheKey, $annotations, null);
     return $annotations;
 }
Esempio n. 3
0
 /**
  * Gets the annotations applied to a method.
  * 
  * @param string|ReflectionClass $class The name or ReflectionClass of the class that owns the method.
  * @param string|ReflectionMethod $property The name or ReflectionMethod of the method from which
  * the annotations should be read.
  * @return array An array of Annotations.
  */
 public function getMethodAnnotations(ReflectionMethod $method)
 {
     $cacheKey = $method->getDeclaringClass()->getName() . '#' . $method->getName() . self::$CACHE_SALT;
     //FIXME: Just use ->fetch(), otherwise some drivers, i.e. APC will fetch twice because they
     // implement contains() in terms of fetch(), *sigh*.
     if ($this->_cache->contains($cacheKey)) {
         return $this->_cache->fetch($cacheKey);
     }
     $context = "method " . $method->getDeclaringClass()->getName() . "::" . $method->getName() . "()";
     $annotations = $this->_parser->parse($method->getDocComment(), $context);
     $this->_cache->save($cacheKey, $annotations, null);
     return $annotations;
 }