CoreFiles by mySites.guru
BeforeDisplayMethods.php54 lines, 1,338 bytes, from Joomla_4.2.0-beta3-Beta-Full_Package.zip
Raw History Compare with 4.2.0-beta2
md5
dbf93ce20e0772f73cd34dc4ede2b732
sha1
2e92b8d16f2bd5e5a231d54930a2c62bb67c40cc
sha256
3bdd42137795c991f48d9a6dbbf6da6c413cd9aa6956b836031d1ce10f3446d6
<?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;

use DomainException;
use Joomla\CMS\Event\AbstractImmutableEvent;
use Joomla\CMS\Event\Result\ResultAware;
use Joomla\CMS\User\User;

/**
 * Concrete Event class for the onUserMultifactorBeforeDisplayMethods event
 *
 * @since 4.2.0
 */
class BeforeDisplayMethods extends AbstractImmutableEvent
{
    use ResultAware;

    /**
     * Public constructor
     *
     * @param   User  $user  The user the MFA methods are displayed for
     *
     * @since   4.2.0
     */
    public function __construct(User $user)
    {
        parent::__construct('onUserMultifactorBeforeDisplayMethods', ['user' => $user]);
    }

    /**
     * Validate the value of the 'user' named parameter
     *
     * @param   User  $value  The value to validate
     *
     * @return  User
     * @since   4.2.0
     */
    public function setUser(User $value): User
    {
        if (empty($value) || ($value->id <= 0) || ($value->guest == 1)) {
            throw new DomainException(sprintf('Argument \'user\' of event %s must be a non-guest User object.', $this->name));
        }

        return $value;
    }
}

The same content is in 5 releases, Joomla 4.2.0-beta3 to 4.2.1-rc2. See them all, or every version of this file.