public function params($id = null, $array = false)
    {
        $config = Grav::instance()['config'];
        $sep = $config->get('system.param_sep');

        $params = null;
        if ($id === null) {
            if ($array) {
                return $this->params;
            }
            $output = [];
            foreach ($this->params as $key => $value) {
                $output[] = "{$key}{$sep}{$value}";
                $params = '/' . implode('/', $output);
            }
        } elseif (isset($this->params[$id])) {
            if ($array) {
                return $this->params[$id];
            }
            $params = "/{$id}{$sep}{$this->params[$id]}";
        }

        return $params;
    }
public function params($id = null, $array = false)
    {
        $config = Grav::instance()['config'];
        $sep = $config->get('system.param_sep');

        $params = null;
        if ($id === null) {
            if ($array) {
                return $this->params;
            }
            $output = [];
            foreach ($this->params as $key => $value) {
                $output[] = "{$key}{$sep}{$value}";
                $params = '/' . implode('/', $output);
            }
        } elseif (isset($this->params[$id])) {
            if ($array) {
                return $this->params[$id];
            }
            $params = "/{$id}{$sep}{$this->params[$id]}";
        }

        return $params;
    }
public function params ( $ id = null , $ array = false ) { $ config = Grav :: instance ( ) [ 'config' ] ; $ sep = $ config -> get ( 'system.param_sep' ) ; $ params = null ; if ( $ id === null ) { if ( $ array ) { return $ this -> params ; } $ output = [ ] ; foreach ( $ this -> params as $ key => $ value ) { $ output [ ] = "{$key}{$sep}{$value}" ; $ params = '/' . implode ( '/' , $ output ) ; } } elseif ( isset ( $ this -> params [ $ id ] ) ) { if ( $ array ) { return $ this -> params [ $ id ] ; } $ params = "/{$id}{$sep}{$this->params[$id]}" ; } return $ params ; }
Return all or a single query parameter as a URI compatible string.

@param string $id Optional parameter name.
@param boolean $array return the array format or not

@return null|string|array
Return all or a single query parameter as a URI compatible string .