src/API.php
public function set(string $link = null, string $method = null): \TheCMSThread\Classes\API
    {
        if ($link === null) {
            if (isset($_SERVER['REQUEST_URI']) === false) {
                $_SERVER['REQUEST_URI'] = '/';
            }
            $link = str_replace("?" . $_SERVER["QUERY_STRING"], "", $_SERVER["REQUEST_URI"]);
        }
        $link = '/' . trim($link, '/');

        if ($method === null) {
            if (isset($_SERVER['REQUEST_METHOD']) === false) {
                $_SERVER['REQUEST_METHOD'] = 'GET';
            }
            $method = $_SERVER['REQUEST_METHOD'];
        }
        if ($method == 'POST' && empty($_POST['_method']) === false) {
            $method = $_POST['_method'];
            unset($_POST['_method']);
        }

        $this->match = $this->router->match($link, $method);
        return $this;
    }
public function set(string $link = null, string $method = null): \TheCMSThread\Classes\API
    {
        if ($link === null) {
            if (isset($_SERVER['REQUEST_URI']) === false) {
                $_SERVER['REQUEST_URI'] = '/';
            }
            $link = str_replace("?" . $_SERVER["QUERY_STRING"], "", $_SERVER["REQUEST_URI"]);
        }
        $link = '/' . trim($link, '/');

        if ($method === null) {
            if (isset($_SERVER['REQUEST_METHOD']) === false) {
                $_SERVER['REQUEST_METHOD'] = 'GET';
            }
            $method = $_SERVER['REQUEST_METHOD'];
        }
        if ($method == 'POST' && empty($_POST['_method']) === false) {
            $method = $_POST['_method'];
            unset($_POST['_method']);
        }

        $this->match = $this->router->match($link, $method);
        return $this;
    }
public function set ( string $ link = null , string $ method = null ) : \ TheCMSThread \ Classes \ API { if ( $ link === null ) { if ( isset ( $ _SERVER [ 'REQUEST_URI' ] ) === false ) { $ _SERVER [ 'REQUEST_URI' ] = '/' ; } $ link = str_replace ( "?" . $ _SERVER [ "QUERY_STRING" ] , "" , $ _SERVER [ "REQUEST_URI" ] ) ; } $ link = '/' . trim ( $ link , '/' ) ; if ( $ method === null ) { if ( isset ( $ _SERVER [ 'REQUEST_METHOD' ] ) === false ) { $ _SERVER [ 'REQUEST_METHOD' ] = 'GET' ; } $ method = $ _SERVER [ 'REQUEST_METHOD' ] ; } if ( $ method == 'POST' && empty ( $ _POST [ '_method' ] ) === false ) { $ method = $ _POST [ '_method' ] ; unset ( $ _POST [ '_method' ] ) ; } $ this -> match = $ this -> router -> match ( $ link , $ method ) ; return $ this ; }
Set the active API link

@param   string  $link   The route to be set to.
@param   string  $method The method to be set to.

@return  TheCMSThread\Classes\API
Set the active API link