[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/src/Component/Router/ -> RouterServiceTrait.php (source)

   1  <?php
   2  
   3  /**
   4   * Joomla! Content Management System
   5   *
   6   * @copyright  (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
   7   * @license    GNU General Public License version 2 or later; see LICENSE.txt
   8   */
   9  
  10  namespace Joomla\CMS\Component\Router;
  11  
  12  use Joomla\CMS\Application\CMSApplicationInterface;
  13  use Joomla\CMS\Menu\AbstractMenu;
  14  
  15  // phpcs:disable PSR1.Files.SideEffects
  16  \defined('JPATH_PLATFORM') or die;
  17  // phpcs:enable PSR1.Files.SideEffects
  18  
  19  /**
  20   * Trait to implement AssociationServiceInterface
  21   *
  22   * @since  4.0.0
  23   */
  24  trait RouterServiceTrait
  25  {
  26      /**
  27       * The router factory.
  28       *
  29       * @var RouterFactoryInterface
  30       *
  31       * @since  4.0.0
  32       */
  33      private $routerFactory = null;
  34  
  35      /**
  36       * Returns the router.
  37       *
  38       * @param   CMSApplicationInterface  $application  The application object
  39       * @param   AbstractMenu             $menu         The menu object to work with
  40       *
  41       * @return  RouterInterface
  42       *
  43       * @since  4.0.0
  44       */
  45      public function createRouter(CMSApplicationInterface $application, AbstractMenu $menu): RouterInterface
  46      {
  47          return $this->routerFactory->createRouter($application, $menu);
  48      }
  49  
  50      /**
  51       * The router factory.
  52       *
  53       * @param   RouterFactoryInterface  $routerFactory  The router factory
  54       *
  55       * @return  void
  56       *
  57       * @since  4.0.0
  58       */
  59      public function setRouterFactory(RouterFactoryInterface $routerFactory)
  60      {
  61          $this->routerFactory = $routerFactory;
  62      }
  63  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer