[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/components/com_users/src/Service/ -> Router.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Site
   5   * @subpackage  com_users
   6   *
   7   * @copyright   (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
   8   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   9   */
  10  
  11  namespace Joomla\Component\Users\Site\Service;
  12  
  13  use Joomla\CMS\Application\SiteApplication;
  14  use Joomla\CMS\Component\Router\RouterView;
  15  use Joomla\CMS\Component\Router\RouterViewConfiguration;
  16  use Joomla\CMS\Component\Router\Rules\MenuRules;
  17  use Joomla\CMS\Component\Router\Rules\NomenuRules;
  18  use Joomla\CMS\Component\Router\Rules\StandardRules;
  19  use Joomla\CMS\Menu\AbstractMenu;
  20  
  21  // phpcs:disable PSR1.Files.SideEffects
  22  \defined('_JEXEC') or die;
  23  // phpcs:enable PSR1.Files.SideEffects
  24  
  25  /**
  26   * Routing class from com_users
  27   *
  28   * @since  3.2
  29   */
  30  class Router extends RouterView
  31  {
  32      /**
  33       * Users Component router constructor
  34       *
  35       * @param   SiteApplication  $app   The application object
  36       * @param   AbstractMenu     $menu  The menu object to work with
  37       */
  38      public function __construct(SiteApplication $app, AbstractMenu $menu)
  39      {
  40          $this->registerView(new RouterViewConfiguration('login'));
  41          $profile = new RouterViewConfiguration('profile');
  42          $profile->addLayout('edit');
  43          $this->registerView($profile);
  44          $this->registerView(new RouterViewConfiguration('registration'));
  45          $this->registerView(new RouterViewConfiguration('remind'));
  46          $this->registerView(new RouterViewConfiguration('reset'));
  47          $this->registerView(new RouterViewConfiguration('callback'));
  48          $this->registerView(new RouterViewConfiguration('captive'));
  49          $this->registerView(new RouterViewConfiguration('methods'));
  50  
  51          $method = new RouterViewConfiguration('method');
  52          $method->setKey('id');
  53          $this->registerView($method);
  54  
  55          parent::__construct($app, $menu);
  56  
  57          $this->attachRule(new MenuRules($this));
  58          $this->attachRule(new StandardRules($this));
  59          $this->attachRule(new NomenuRules($this));
  60      }
  61  
  62      /**
  63       * Get the method ID from a URL segment
  64       *
  65       * @param   string  $segment  The URL segment
  66       * @param   array   $query    The URL query parameters
  67       *
  68       * @return integer
  69       * @since 4.2.0
  70       */
  71      public function getMethodId($segment, $query)
  72      {
  73          return (int) $segment;
  74      }
  75  
  76      /**
  77       * Get a segment from a method ID
  78       *
  79       * @param   integer  $id     The method ID
  80       * @param   array    $query  The URL query parameters
  81       *
  82       * @return int[]
  83       * @since 4.2.0
  84       */
  85      public function getMethodSegment($id, $query)
  86      {
  87          return [$id => (int) $id];
  88      }
  89  }


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