src/sb/Controller/REST.php
public function render()
    {
        if ($this->onBeforeRender() === false) {
            return $this->notFound();
        }

        $method = \sb\Gateway::$request->method;
        if (method_exists($this, $method)) {
            $reflection = new \ReflectionMethod($this, $method);

            //check for phpdocs
            $docs = $reflection->getDocComment();
            $servable = false;
            if (!empty($docs)) {
                if (preg_match("~@servable (true|false)~", $docs, $match)) {
                    $servable = $match[1] == 'true' ? true : false;
                }
            }

            if ($servable) {
                return $this->filterOutput($this->$method());
            } else {
                return $this->filterOutput($this->notFound($method));
            }
        } else {
            return $this->filterOutput($this->notFound($method));
        }
    }
public function render()
    {
        if ($this->onBeforeRender() === false) {
            return $this->notFound();
        }

        $method = \sb\Gateway::$request->method;
        if (method_exists($this, $method)) {
            $reflection = new \ReflectionMethod($this, $method);

            //check for phpdocs
            $docs = $reflection->getDocComment();
            $servable = false;
            if (!empty($docs)) {
                if (preg_match("~@servable (true|false)~", $docs, $match)) {
                    $servable = $match[1] == 'true' ? true : false;
                }
            }

            if ($servable) {
                return $this->filterOutput($this->$method());
            } else {
                return $this->filterOutput($this->notFound($method));
            }
        } else {
            return $this->filterOutput($this->notFound($method));
        }
    }
public function render ( ) { if ( $ this -> onBeforeRender ( ) === false ) { return $ this -> notFound ( ) ; } $ method = \ sb \ Gateway :: $ request -> method ; if ( method_exists ( $ this , $ method ) ) { $ reflection = new \ ReflectionMethod ( $ this , $ method ) ; //check for phpdocs $ docs = $ reflection -> getDocComment ( ) ; $ servable = false ; if ( ! empty ( $ docs ) ) { if ( preg_match ( "~@servable (true|false)~" , $ docs , $ match ) ) { $ servable = $ match [ 1 ] == 'true' ? true : false ; } } if ( $ servable ) { return $ this -> filterOutput ( $ this -> $ method ( ) ) ; } else { return $ this -> filterOutput ( $ this -> notFound ( $ method ) ) ; } } else { return $ this -> filterOutput ( $ this -> notFound ( $ method ) ) ; } }
Used to render the output through the filterOutput method by calling the
handler appropriate to the HTTP request
@return string
Used to render the output through the filterOutput method by calling the handler appropriate to the HTTP request