src/sb/Controller/JSON/RPC2/Server.php
protected function getPhpdoc($method)
    {

        $reflect = false;
        
        foreach($this->served_classes as $class){
            if (\method_exists($class, $method)) {
                $reflect = new \ReflectionMethod($class, $method);
                break;
            }
        
        }
        
        $response = new \stdClass();
        
         if(!$reflect){
            $response->error = new \sb\JSON\RPC2\Error();
            $response->error->code = -32602;
            $response->error->message = "Invalid method parameters";
            return $response;
        }

        $response->phpdoc = $reflect->getDocComment();

        if (\preg_match("~@return (.*?) (.*?)\*/$~s", $response->phpdoc, $match)) {
            $response->return_type = $match[1];
        } else {
            $response->return_type = 'n/a';
        }

        return $response;
    }
protected function getPhpdoc($method)
    {

        $reflect = false;
        
        foreach($this->served_classes as $class){
            if (\method_exists($class, $method)) {
                $reflect = new \ReflectionMethod($class, $method);
                break;
            }
        
        }
        
        $response = new \stdClass();
        
         if(!$reflect){
            $response->error = new \sb\JSON\RPC2\Error();
            $response->error->code = -32602;
            $response->error->message = "Invalid method parameters";
            return $response;
        }

        $response->phpdoc = $reflect->getDocComment();

        if (\preg_match("~@return (.*?) (.*?)\*/$~s", $response->phpdoc, $match)) {
            $response->return_type = $match[1];
        } else {
            $response->return_type = 'n/a';
        }

        return $response;
    }
protected function getPhpdoc ( $ method ) { $ reflect = false ; foreach ( $ this -> served_classes as $ class ) { if ( \ method_exists ( $ class , $ method ) ) { $ reflect = new \ ReflectionMethod ( $ class , $ method ) ; break ; } } $ response = new \ stdClass ( ) ; if ( ! $ reflect ) { $ response -> error = new \ sb \ JSON \ RPC2 \ Error ( ) ; $ response -> error -> code = - 32602 ; $ response -> error -> message = "Invalid method parameters" ; return $ response ; } $ response -> phpdoc = $ reflect -> getDocComment ( ) ; if ( \ preg_match ( "~@return (.*?) (.*?)\*/$~s" , $ response -> phpdoc , $ match ) ) { $ response -> return_type = $ match [ 1 ] ; } else { $ response -> return_type = 'n/a' ; } return $ response ; }
Get php doc and return_type for method by name
@param string $name The name of the method to grab the docs for
@return Object with return_type and phpdoc property
Get php doc and return_type for method by name