[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/src/Event/MultiFactor/ -> Captive.php (source)

   1  <?php
   2  
   3  /**
   4   * Joomla! Content Management System
   5   *
   6   * @copyright  (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
   7   * @license    GNU General Public License version 2 or later; see LICENSE
   8   */
   9  
  10  namespace Joomla\CMS\Event\MultiFactor;
  11  
  12  use DomainException;
  13  use Joomla\CMS\Event\AbstractImmutableEvent;
  14  use Joomla\CMS\Event\Result\ResultAware;
  15  use Joomla\CMS\Event\Result\ResultAwareInterface;
  16  use Joomla\CMS\Event\Result\ResultTypeObjectAware;
  17  use Joomla\Component\Users\Administrator\DataShape\CaptiveRenderOptions;
  18  use Joomla\Component\Users\Administrator\Table\MfaTable;
  19  
  20  // phpcs:disable PSR1.Files.SideEffects
  21  \defined('JPATH_PLATFORM') or die;
  22  // phpcs:enable PSR1.Files.SideEffects
  23  
  24  /**
  25   * Concrete Event class for the onUserMultifactorCaptive event
  26   *
  27   * @since 4.2.0
  28   */
  29  class Captive extends AbstractImmutableEvent implements ResultAwareInterface
  30  {
  31      use ResultAware;
  32      use ResultTypeObjectAware;
  33  
  34      /**
  35       * Public constructor
  36       *
  37       * @param   MfaTable  $record  The MFA record to use in the captive login page
  38       *
  39       * @since   4.2.0
  40       */
  41      public function __construct(MfaTable $record)
  42      {
  43          parent::__construct('onUserMultifactorCaptive', ['record' => $record]);
  44  
  45          $this->resultIsNullable        = true;
  46          $this->resultAcceptableClasses = [
  47              CaptiveRenderOptions::class,
  48          ];
  49      }
  50  
  51      /**
  52       * Validate the value of the 'record' named parameter
  53       *
  54       * @param   MfaTable  $value  The value to validate
  55       *
  56       * @return  MfaTable
  57       * @since   4.2.0
  58       */
  59      public function setRecord(MfaTable $value): MfaTable
  60      {
  61          if (empty($value)) {
  62              throw new DomainException(sprintf('Argument \'record\' of event %s must be a MfaTable object.', $this->name));
  63          }
  64  
  65          return $value;
  66      }
  67  }


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