/** * testGetModifiersReturnsPreviousSetValue * * @return void * @since 1.0.0 */ public function testGetModifiersReturnsPreviousSetValue() { $method = new PHP_Depend_Code_Method('method'); $method->setModifiers(PHP_Depend_ConstantsI::IS_ABSTRACT); $this->assertEquals(PHP_Depend_ConstantsI::IS_ABSTRACT, $method->getModifiers()); }
/** * 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 PHP_Depend_Code_Method $method The imported trait method. * * @return PHP_Depend_Code_Method[] */ private function getAliasesFor(PHP_Depend_Code_Method $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 &= ~(PHP_Depend_ConstantsI::IS_PUBLIC | PHP_Depend_ConstantsI::IS_PROTECTED | PHP_Depend_ConstantsI::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); }