protected function injectMethod(ClassReflection $class, $methodTag)
    {
        $data = $this->parseMethod($methodTag);

        // Bail if the method format is invalid
        if (!$data) {
            return false;
        }

        $method = new MethodReflection($data['name'], $class->getLine());
        $method->setDocComment($data['description']);
        $method->setShortDesc($data['description']);

        if ($data['hint']) {
            $method->setHint(array(array($data['hint'], null)));
        }

        // Add arguments to the method
        foreach ($data['args'] as $name => $arg) {
            $param = new ParameterReflection($name, $class->getLine());
            if (!empty($arg['hint'])) {
                $param->setHint(array(array($arg['hint'], null)));
            }
            if (!empty($arg['default'])) {
                $param->setDefault($arg['default']);
            }
            $method->addParameter($param);
        }

        $class->addMethod($method);

        return true;
    }
protected function injectMethod(ClassReflection $class, $methodTag)
    {
        $data = $this->parseMethod($methodTag);

        // Bail if the method format is invalid
        if (!$data) {
            return false;
        }

        $method = new MethodReflection($data['name'], $class->getLine());
        $method->setDocComment($data['description']);
        $method->setShortDesc($data['description']);

        if ($data['hint']) {
            $method->setHint(array(array($data['hint'], null)));
        }

        // Add arguments to the method
        foreach ($data['args'] as $name => $arg) {
            $param = new ParameterReflection($name, $class->getLine());
            if (!empty($arg['hint'])) {
                $param->setHint(array(array($arg['hint'], null)));
            }
            if (!empty($arg['default'])) {
                $param->setDefault($arg['default']);
            }
            $method->addParameter($param);
        }

        $class->addMethod($method);

        return true;
    }
protected function injectMethod ( ClassReflection $ class , $ methodTag ) { $ data = $ this -> parseMethod ( $ methodTag ) ; // Bail if the method format is invalid if ( ! $ data ) { return false ; } $ method = new MethodReflection ( $ data [ 'name' ] , $ class -> getLine ( ) ) ; $ method -> setDocComment ( $ data [ 'description' ] ) ; $ method -> setShortDesc ( $ data [ 'description' ] ) ; if ( $ data [ 'hint' ] ) { $ method -> setHint ( array ( array ( $ data [ 'hint' ] , null ) ) ) ; } // Add arguments to the method foreach ( $ data [ 'args' ] as $ name => $ arg ) { $ param = new ParameterReflection ( $ name , $ class -> getLine ( ) ) ; if ( ! empty ( $ arg [ 'hint' ] ) ) { $ param -> setHint ( array ( array ( $ arg [ 'hint' ] , null ) ) ) ; } if ( ! empty ( $ arg [ 'default' ] ) ) { $ param -> setDefault ( $ arg [ 'default' ] ) ; } $ method -> addParameter ( $ param ) ; } $ class -> addMethod ( $ method ) ; return true ; }
Adds a new method to the class using an array of tokens.

@param ClassReflection $class     Class reflection
@param string          $methodTag Method tag contents

@return bool
Adds a new method to the class using an array of tokens .