original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: 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
docstring_tokens: Return all or a single query parameter as a URI compatible string .