original_string: protected function _urlChunk($url = null)
      {
          if (empty($url)) {
              $url = '/' . $this->_controller->request->url;
          }
  
          $cacheKey = 'urlChunk_' . md5($url);
          $cache = static::cache($cacheKey);
  
          if ($cache !== null) {
              return $cache;
          }
  
          $parsedURL = Router::parse($url);
          $out = [$url];
          $passArguments = [];
  
          if (!empty($parsedURL['?'])) {
              unset($parsedURL['?']);
          }
  
          if (!empty($parsedURL['pass'])) {
              $passArguments = $parsedURL['pass'];
              $parsedURL['pass'] = null;
              $parsedURL = array_merge($parsedURL, $passArguments);
          }
  
          // "/controller_name/index" -> "/controller"
          if ($parsedURL['action'] === 'index') {
              $parsedURL['action'] = null;
              $out[] = Router::url($parsedURL);
          }
  
          // "/plugin_name/plugin_name/action_name" -> "/plugin_name/action_name"
          if (!empty($parsedURL['plugin']) &&
              strtolower($parsedURL['controller']) === strtolower($parsedURL['plugin'])
          ) {
              $parsedURL['plugin'] = null;
              $out[] = Router::url($parsedURL);
          }
  
          foreach (array_reverse($passArguments) as $pass) {
              unset($parsedURL[array_search($pass, $parsedURL)]);
              $out[] = Router::url($parsedURL);
          }
  
          $out = array_map(function ($value) {
              if (str_starts_with($value, $this->_controller->request->base)) {
                  return str_replace_once($this->_controller->request->base, '', $value);
              }
  
              return $value;
          }, $out);
  
          return static::cache($cacheKey, array_unique($out));
      }
code: protected function _urlChunk($url = null)
      {
          if (empty($url)) {
              $url = '/' . $this->_controller->request->url;
          }
  
          $cacheKey = 'urlChunk_' . md5($url);
          $cache = static::cache($cacheKey);
  
          if ($cache !== null) {
              return $cache;
          }
  
          $parsedURL = Router::parse($url);
          $out = [$url];
          $passArguments = [];
  
          if (!empty($parsedURL['?'])) {
              unset($parsedURL['?']);
          }
  
          if (!empty($parsedURL['pass'])) {
              $passArguments = $parsedURL['pass'];
              $parsedURL['pass'] = null;
              $parsedURL = array_merge($parsedURL, $passArguments);
          }
  
          // "/controller_name/index" -> "/controller"
          if ($parsedURL['action'] === 'index') {
              $parsedURL['action'] = null;
              $out[] = Router::url($parsedURL);
          }
  
          // "/plugin_name/plugin_name/action_name" -> "/plugin_name/action_name"
          if (!empty($parsedURL['plugin']) &&
              strtolower($parsedURL['controller']) === strtolower($parsedURL['plugin'])
          ) {
              $parsedURL['plugin'] = null;
              $out[] = Router::url($parsedURL);
          }
  
          foreach (array_reverse($passArguments) as $pass) {
              unset($parsedURL[array_search($pass, $parsedURL)]);
              $out[] = Router::url($parsedURL);
          }
  
          $out = array_map(function ($value) {
              if (str_starts_with($value, $this->_controller->request->base)) {
                  return str_replace_once($this->_controller->request->base, '', $value);
              }
  
              return $value;
          }, $out);
  
          return static::cache($cacheKey, array_unique($out));
      }
code_tokens: protected function _urlChunk ( $ url = null ) { if ( empty ( $ url ) ) { $ url = '/' . $ this -> _controller -> request -> url ; } $ cacheKey = 'urlChunk_' . md5 ( $ url ) ; $ cache = static :: cache ( $ cacheKey ) ; if ( $ cache !== null ) { return $ cache ; } $ parsedURL = Router :: parse ( $ url ) ; $ out = [ $ url ] ; $ passArguments = [ ] ; if ( ! empty ( $ parsedURL [ '?' ] ) ) { unset ( $ parsedURL [ '?' ] ) ; } if ( ! empty ( $ parsedURL [ 'pass' ] ) ) { $ passArguments = $ parsedURL [ 'pass' ] ; $ parsedURL [ 'pass' ] = null ; $ parsedURL = array_merge ( $ parsedURL , $ passArguments ) ; } // "/controller_name/index" -> "/controller" if ( $ parsedURL [ 'action' ] === 'index' ) { $ parsedURL [ 'action' ] = null ; $ out [ ] = Router :: url ( $ parsedURL ) ; } // "/plugin_name/plugin_name/action_name" -> "/plugin_name/action_name" if ( ! empty ( $ parsedURL [ 'plugin' ] ) && strtolower ( $ parsedURL [ 'controller' ] ) === strtolower ( $ parsedURL [ 'plugin' ] ) ) { $ parsedURL [ 'plugin' ] = null ; $ out [ ] = Router :: url ( $ parsedURL ) ; } foreach ( array_reverse ( $ passArguments ) as $ pass ) { unset ( $ parsedURL [ array_search ( $ pass , $ parsedURL ) ] ) ; $ out [ ] = Router :: url ( $ parsedURL ) ; } $ out = array_map ( function ( $ value ) { if ( str_starts_with ( $ value , $ this -> _controller -> request -> base ) ) { return str_replace_once ( $ this -> _controller -> request -> base , '' , $ value ) ; } return $ value ; } , $ out ) ; return static :: cache ( $ cacheKey , array_unique ( $ out ) ) ; }
docstring: Returns possible URL combinations for the given URL or current request's URL.
  
  ### Example:
  
  For the given URL, `/admin/content/manage/index/arg1/arg2?get1=v1&get2=v2`
  where:
  
  - `/admin`: Prefix.
  - `/content`: Plugin name.
  - `/manage`: Controller name.
  - `/index`: Controller's action.
  - `/arg1` and `/arg2`: Action's arguments.
  - `get1` and `get2`: GET arguments.
  
  The following array will be returned by this method:
  
  ```php
  [
  "/admin/content/content/index/arg1/arg2?get1=v1&get2=v2",
  "/admin/content/content/arg1/arg2",
  "/admin/content/arg1/arg2",
  "/admin/content/arg1",
  "/admin/content",
  ]
  ```
  
  @param string|null $url The URL to chunk as string value, set to null
  will use current request URL.
  @return array
docstring_tokens: Returns possible URL combinations for the given URL or current request s URL .