Esempio n. 1
0
 /**
  * Extract method deprecation policy.
  *
  * Return result in the following format:<pre>
  * array(
  *     'removed'      => true,            // either 'deprecated' or 'removed' item must be specified
  *     'deprecated'   => true,
  *     'use_resource' => 'operationName'  // resource to be used instead
  *     'use_method'   => 'operationName'  // method to be used instead
  *     'use_version'  => N,               // version of method to be used instead
  * )
  * </pre>
  *
  * @param ReflectionMethod $methodReflection
  * @return array|bool On success array with policy details; false otherwise.
  * @throws LogicException If deprecation tag format is incorrect.
  */
 protected function _extractDeprecationPolicy(ReflectionMethod $methodReflection)
 {
     $deprecationPolicy = false;
     $methodDocumentation = $methodReflection->getDocComment();
     if ($methodDocumentation) {
         /** Zend server reflection is not able to work with annotation tags of the method. */
         $docBlock = new DocBlockReflection($methodDocumentation);
         $removedTag = $docBlock->getTag('apiRemoved');
         $deprecatedTag = $docBlock->getTag('apiDeprecated');
         if ($removedTag) {
             $deprecationPolicy = array('removed' => true);
             $useMethod = $removedTag->getContent();
         } elseif ($deprecatedTag) {
             $deprecationPolicy = array('deprecated' => true);
             $useMethod = $deprecatedTag->getContent();
         }
         if (isset($useMethod) && is_string($useMethod) && !empty($useMethod)) {
             $this->_extractDeprecationPolicyUseMethod($methodReflection, $useMethod, $deprecationPolicy);
         }
     }
     return $deprecationPolicy;
 }