Back to SiteRouter class

Method __construct

public
__construct
(\Joomla\CMS\Application\CMSApplication $app = null, \Joomla\CMS\Menu\AbstractMenu $menu = null)
Class constructor
Parameters
  • \Joomla\CMS\Application\CMSApplication $app Application Object
  • \Joomla\CMS\Menu\AbstractMenu $menu Menu object
Since
  • 3.4
Class: SiteRouter
Project: Joomla

Method __construct - Source code

/**
 * Class constructor
 *
 * @param   CMSApplication  $app   Application Object
 * @param   AbstractMenu    $menu  Menu object
 *
 * @since   3.4
 */
public function __construct(CMSApplication $app = null, AbstractMenu $menu = null)
{
    $this->app = $app ?: Factory::getContainer()->get(SiteApplication::class);
    $this->menu = $menu ?: $this->app->getMenu();
    // Add core rules
    if ($this->app->get('force_ssl') === 2) {
        $this->attachParseRule(array($this, 'parseCheckSSL'), self::PROCESS_BEFORE);
    }
    $this->attachParseRule(array($this, 'parseInit'), self::PROCESS_BEFORE);
    $this->attachBuildRule(array($this, 'buildInit'), self::PROCESS_BEFORE);
    $this->attachBuildRule(array($this, 'buildComponentPreprocess'), self::PROCESS_BEFORE);
    if ($this->app->get('sef', 1)) {
        if ($this->app->get('sef_suffix')) {
            $this->attachParseRule(array($this, 'parseFormat'), self::PROCESS_BEFORE);
            $this->attachBuildRule(array($this, 'buildFormat'), self::PROCESS_AFTER);
        }
        $this->attachParseRule(array($this, 'parseSefRoute'), self::PROCESS_DURING);
        $this->attachBuildRule(array($this, 'buildSefRoute'), self::PROCESS_DURING);
        $this->attachParseRule(array($this, 'parsePaginationData'), self::PROCESS_AFTER);
        $this->attachBuildRule(array($this, 'buildPaginationData'), self::PROCESS_AFTER);
        if ($this->app->get('sef_rewrite')) {
            $this->attachBuildRule(array($this, 'buildRewrite'), self::PROCESS_AFTER);
        }
    }
    $this->attachParseRule(array($this, 'parseRawRoute'), self::PROCESS_DURING);
    $this->attachBuildRule(array($this, 'buildBase'), self::PROCESS_AFTER);
}