Jacwright\RestServer\RestServer::__construct PHP Method

__construct() public method

The constructor.
public __construct ( string $mode = 'debug', $realm = 'Rest Server' )
$mode string The mode, either debug or production
    public function __construct($mode = 'debug', $realm = 'Rest Server')
    {
        $this->mode = $mode;
        $this->realm = $realm;
        // Set the root
        $dir = str_replace('\\', '/', dirname(str_replace($_SERVER['DOCUMENT_ROOT'], '', $_SERVER['SCRIPT_FILENAME'])));
        if ($dir == '.') {
            $dir = '/';
        } else {
            // add a slash at the beginning and end
            if (substr($dir, -1) != '/') {
                $dir .= '/';
            }
            if (substr($dir, 0, 1) != '/') {
                $dir = '/' . $dir;
            }
        }
        $this->root = $dir;
    }