public function prefix(string $prefix) {
        if ($this->running) {
            throw new \Error("Cannot alter routes after the server has started");
        }

        $prefix = \trim($prefix, "/");

        if ($prefix !== "") {
            $this->prefix = "/" . $prefix . $this->prefix;
        }
    }
public function prefix(string $prefix) {
        if ($this->running) {
            throw new \Error("Cannot alter routes after the server has started");
        }

        $prefix = \trim($prefix, "/");

        if ($prefix !== "") {
            $this->prefix = "/" . $prefix . $this->prefix;
        }
    }
public function prefix ( string $ prefix ) { if ( $ this -> running ) { throw new \ Error ( "Cannot alter routes after the server has started" ) ; } $ prefix = \ trim ( $ prefix , "/" ) ; if ( $ prefix !== "" ) { $ this -> prefix = "/" . $ prefix . $ this -> prefix ; } }
Prefix all currently defined routes with a given prefix.

If this method is called multiple times, the second prefix will be before the first prefix and so on.

@param string $prefix Path segment to prefix, leading and trailing slashes will be normalized.
Prefix all currently defined routes with a given prefix .