Back to SiteRouter class

Method parseFormat

public void
parseFormat
(mixed &$router, mixed &$uri)
Parse the format of the request
Parameters
  • \Joomla\CMS\Router\SiteRouter & $router Router object
  • \Joomla\CMS\Uri\Uri & $uri URI object to process
Returns
  • void
Since
  • 4.0.0
Class: SiteRouter
Project: Joomla

Method parseFormat - Source code

/**
 * Parse the format of the request
 *
 * @param   SiteRouter  &$router  Router object
 * @param   Uri         &$uri     URI object to process
 *
 * @return  void
 *
 * @since   4.0.0
 */
public function parseFormat(&$router, &$uri)
{
    $route = $uri->getPath();
    // Identify format
    if (!(substr($route, -9) === 'index.php' || substr($route, -1) === '/') && ($suffix = pathinfo($route, PATHINFO_EXTENSION))) {
        $uri->setVar('format', $suffix);
        $route = str_replace('.' . $suffix, '', $route);
        $uri->setPath($route);
    }
}