CoreFiles by mySites.guru
SaveSetup.php87 lines, 1,952 bytes, from Joomla_4.2.0-beta2-Beta-Full_Package.zip
Raw History Compare with 4.2.0-beta1
md5
2df8efaf8ff44d1070905d57596b0c0f
sha1
61d6a74cd85dd694541432c26f87b970a25f71c4
sha256
bd787deedaf9ef7a99ab57b2d9bb86badd43d02502d3f562b72f7ba9d171b186
<?php
/**
 * Joomla! Content Management System
 *
 * @copyright  (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
 * @license    GNU General Public License version 2 or later; see LICENSE
 */

namespace Joomla\CMS\Event\MultiFactor;

\defined('JPATH_PLATFORM') or die;

use DomainException;
use Joomla\CMS\Event\AbstractImmutableEvent;
use Joomla\CMS\Event\Result\ResultAware;
use Joomla\CMS\Event\Result\ResultAwareInterface;
use Joomla\CMS\Event\Result\ResultTypeArrayAware;
use Joomla\Component\Users\Administrator\Table\MfaTable;
use Joomla\Input\Input;

/**
 * Concrete Event class for the onUserMultifactorSaveSetup event
 *
 * @since 4.2.0
 */
class SaveSetup extends AbstractImmutableEvent implements ResultAwareInterface
{
	use ResultAware;
	use ResultTypeArrayAware;

	/**
	 * Public constructor
	 *
	 * @param   MfaTable  $record  The record to save into
	 * @param   Input     $input   The application input object
	 *
	 * @since   4.2.0
	 */
	public function __construct(MfaTable $record, Input $input)
	{
		parent::__construct(
			'onUserMultifactorSaveSetup',
			[
				'record' => $record,
				'input'  => $input,
			]
		);

		$this->resultIsNullable = true;
	}

	/**
	 * Validate the value of the 'record' named parameter
	 *
	 * @param   MfaTable  $value  The value to validate
	 *
	 * @return  MfaTable
	 * @since   4.2.0
	 */
	public function setRecord(MfaTable $value): MfaTable
	{
		if (empty($value))
		{
			throw new DomainException(sprintf('Argument \'record\' of event %s must be a MfaTable object.', $this->name));
		}

		return $value;
	}

	/**
	 * Validate the value of the 'record' named parameter
	 *
	 * @param   Input  $value  The value to validate
	 *
	 * @return  Input
	 * @since   4.2.0
	 */
	public function setInput(Input $value): Input
	{
		if (empty($value))
		{
			throw new DomainException(sprintf('Argument \'input\' of event %s must be an Input object.', $this->name));
		}

		return $value;
	}
}

The same content is in 2 releases, Joomla 4.2.0-beta1 to 4.2.0-beta2. See them all, or every version of this file.