示例#1
0
 /**
  * Returns an <b>array</b> with all aliases for the given method. If no
  * alias exists for the given method, this method will simply return the
  * an <b>array</b> with the original method.
  *
  * @param  \PDepend\Source\AST\ASTMethod $method
  * @return \PDepend\Source\AST\ASTMethod[]
  */
 private function getAliasesFor(ASTMethod $method)
 {
     $name = strtolower($method->getName());
     $newNames = array();
     foreach ($this->getAliases() as $alias) {
         $name2 = strtolower($alias->getImage());
         if ($name2 !== $name) {
             continue;
         }
         $modifier = $method->getModifiers();
         if (-1 < $alias->getNewModifier()) {
             $modifier &= ~(State::IS_PUBLIC | State::IS_PROTECTED | State::IS_PRIVATE);
             $modifier |= $alias->getNewModifier();
         }
         $newName = $method->getName();
         if ($alias->getNewName()) {
             $newName = $alias->getNewName();
         }
         if (0 === count($alias->getChildren())) {
             $newMethod = clone $method;
             $newMethod->setName($newName);
             $newMethod->setModifiers($modifier);
             $newNames[] = $newMethod;
             continue;
         }
         if ($alias->getChild(0)->getType() !== $method->getParent()) {
             continue;
         }
         $newMethod = clone $method;
         $newMethod->setName($newName);
         $newMethod->setModifiers($modifier);
         $newNames[] = $newMethod;
     }
     if (count($newNames) > 0) {
         return $newNames;
     }
     return array($method);
 }
 /**
  * testGetModifiersReturnsPreviousSetValue
  *
  * @return void
  * @since 1.0.0
  */
 public function testGetModifiersReturnsPreviousSetValue()
 {
     $method = new ASTMethod('method');
     $method->setModifiers(State::IS_ABSTRACT);
     $this->assertEquals(State::IS_ABSTRACT, $method->getModifiers());
 }