PDepend\Source\AST\AbstractASTType::getMethods PHP Method

getMethods() public method

Returns all {@link \PDepend\Source\AST\ASTMethod} objects in this type.
public getMethods ( ) : PDepend\Source\AST\ASTMethod[]
return PDepend\Source\AST\ASTMethod[]
    public function getMethods()
    {
        if (is_array($this->methods)) {
            return new ASTArtifactList($this->methods);
        }
        $methods = (array) $this->cache->type('methods')->restore($this->getId());
        foreach ($methods as $method) {
            $method->compilationUnit = $this->compilationUnit;
            $method->setParent($this);
        }
        return new ASTArtifactList($methods);
    }

Usage Example

 /**
  * Calculates the Weight Method Per Class metric.
  *
  * @param  \PDepend\Source\AST\AbstractASTType $type
  * @return integer[]
  * @since  1.0.6
  */
 private function calculateWmci(AbstractASTType $type)
 {
     $ccn = array();
     foreach ($type->getMethods() as $method) {
         $ccn[$method->getName()] = $this->cyclomaticAnalyzer->getCcn2($method);
     }
     return $ccn;
 }