[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/src/Event/MultiFactor/ -> SaveSetup.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\ResultTypeArrayAware;
  17  use Joomla\Component\Users\Administrator\Table\MfaTable;
  18  use Joomla\Input\Input;
  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 onUserMultifactorSaveSetup event
  26   *
  27   * @since 4.2.0
  28   */
  29  class SaveSetup extends AbstractImmutableEvent implements ResultAwareInterface
  30  {
  31      use ResultAware;
  32      use ResultTypeArrayAware;
  33  
  34      /**
  35       * Public constructor
  36       *
  37       * @param   MfaTable  $record  The record to save into
  38       * @param   Input     $input   The application input object
  39       *
  40       * @since   4.2.0
  41       */
  42      public function __construct(MfaTable $record, Input $input)
  43      {
  44          parent::__construct(
  45              'onUserMultifactorSaveSetup',
  46              [
  47                  'record' => $record,
  48                  'input'  => $input,
  49              ]
  50          );
  51  
  52          $this->resultIsNullable = true;
  53      }
  54  
  55      /**
  56       * Validate the value of the 'record' named parameter
  57       *
  58       * @param   MfaTable  $value  The value to validate
  59       *
  60       * @return  MfaTable
  61       * @since   4.2.0
  62       */
  63      public function setRecord(MfaTable $value): MfaTable
  64      {
  65          if (empty($value)) {
  66              throw new DomainException(sprintf('Argument \'record\' of event %s must be a MfaTable object.', $this->name));
  67          }
  68  
  69          return $value;
  70      }
  71  
  72      /**
  73       * Validate the value of the 'record' named parameter
  74       *
  75       * @param   Input  $value  The value to validate
  76       *
  77       * @return  Input
  78       * @since   4.2.0
  79       */
  80      public function setInput(Input $value): Input
  81      {
  82          if (empty($value)) {
  83              throw new DomainException(sprintf('Argument \'input\' of event %s must be an Input object.', $this->name));
  84          }
  85  
  86          return $value;
  87      }
  88  }


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