src/sb/Controller/JSON/RPC2/Server.php
public function getMethods($html = true)
    {

        $arr = Array();

        foreach($this->served_classes as $class){
            foreach (\get_class_methods($class) as $method) {

                $reflect = new \ReflectionMethod($class, $method);

                if ($reflect) {
                    
                    if($class == $this){
                        $docs = $reflect->getDocComment();
                        $servable = false;
                        if (!empty($docs)) {
                            if (\preg_match("~@servable (true|false)~", $docs, $match)) {
                                $servable = $match[1] == 'true' ? true : false;
                            }
                        }
                    } else if($reflect->isPublic()){
                        $servable = true;
                    }
                    
                    if (!$servable) {
                        continue;
                    }

                    $params = $reflect->getParameters();
                    $ps = Array();
                    foreach ($params as $param) {
                        $ps[] = '$' . $param->getName();
                    }

                    $key = $method . '(' . implode(', ', $ps) . ')';

                    $arr[$key] = $reflect->getDocComment();
                }
            }
        }
        

        if ($html == false) {
            return $arr;
        } else {
            return $this->methodsToHtml($arr);
        }
    }
public function getMethods($html = true)
    {

        $arr = Array();

        foreach($this->served_classes as $class){
            foreach (\get_class_methods($class) as $method) {

                $reflect = new \ReflectionMethod($class, $method);

                if ($reflect) {
                    
                    if($class == $this){
                        $docs = $reflect->getDocComment();
                        $servable = false;
                        if (!empty($docs)) {
                            if (\preg_match("~@servable (true|false)~", $docs, $match)) {
                                $servable = $match[1] == 'true' ? true : false;
                            }
                        }
                    } else if($reflect->isPublic()){
                        $servable = true;
                    }
                    
                    if (!$servable) {
                        continue;
                    }

                    $params = $reflect->getParameters();
                    $ps = Array();
                    foreach ($params as $param) {
                        $ps[] = '$' . $param->getName();
                    }

                    $key = $method . '(' . implode(', ', $ps) . ')';

                    $arr[$key] = $reflect->getDocComment();
                }
            }
        }
        

        if ($html == false) {
            return $arr;
        } else {
            return $this->methodsToHtml($arr);
        }
    }
public function getMethods ( $ html = true ) { $ arr = Array ( ) ; foreach ( $ this -> served_classes as $ class ) { foreach ( \ get_class_methods ( $ class ) as $ method ) { $ reflect = new \ ReflectionMethod ( $ class , $ method ) ; if ( $ reflect ) { if ( $ class == $ this ) { $ docs = $ reflect -> getDocComment ( ) ; $ servable = false ; if ( ! empty ( $ docs ) ) { if ( \ preg_match ( "~@servable (true|false)~" , $ docs , $ match ) ) { $ servable = $ match [ 1 ] == 'true' ? true : false ; } } } else if ( $ reflect -> isPublic ( ) ) { $ servable = true ; } if ( ! $ servable ) { continue ; } $ params = $ reflect -> getParameters ( ) ; $ ps = Array ( ) ; foreach ( $ params as $ param ) { $ ps [ ] = '$' . $ param -> getName ( ) ; } $ key = $ method . '(' . implode ( ', ' , $ ps ) . ')' ; $ arr [ $ key ] = $ reflect -> getDocComment ( ) ; } } } if ( $ html == false ) { return $ arr ; } else { return $ this -> methodsToHtml ( $ arr ) ; } }
Get the methods available for this \sb\JSON\RPC2_Server instance
@return Array - Object once json_encoded
@servable true
Get the methods available for this \ sb \ JSON \ RPC2_Server instance