CoreFiles by mySites.guru
CaptchaSetupEvent.php66 lines, 1,527 bytes, from Joomla_6.1.2-Stable-Full_Package.zip
Raw History Compare with 6.1.1
md5
7fc8e8c949270d0f19cb1f8397c73b51
sha1
2ba803ae1bedf0b204fec206f0b1f7cc0ec61536
sha256
78a885c054d406678183c2e41a80d23cfee4c007d34fd12b0804a8674b80f78b
<?php

/**
 * Joomla! Content Management System
 *
 * @copyright  (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\CMS\Event\Captcha;

use Joomla\CMS\Captcha\CaptchaRegistry;
use Joomla\CMS\Event\AbstractImmutableEvent;

/**
 * Captcha setup event
 *
 * @since   5.0.0
 */
class CaptchaSetupEvent extends AbstractImmutableEvent
{
    /**
     * Constructor.
     *
     * @param   string  $name       The event name.
     * @param   array   $arguments  The event arguments.
     *
     * @throws  \BadMethodCallException
     *
     * @since   5.0.0
     */
    public function __construct($name, array $arguments = [])
    {
        if (!\array_key_exists('subject', $arguments)) {
            throw new \BadMethodCallException("Argument 'subject' of event {$name} is required but has not been provided");
        }

        parent::__construct($name, $arguments);
    }

    /**
     * Setter for the subject argument
     *
     * @param   CaptchaRegistry  $value  The value to set
     *
     * @return  CaptchaRegistry
     *
     * @since  5.0.0
     */
    protected function onSetSubject(CaptchaRegistry $value): CaptchaRegistry
    {
        return $value;
    }

    /**
     * Returns Captcha Registry instance.
     *
     * @return  CaptchaRegistry
     *
     * @since  5.0.0
     */
    public function getCaptchaRegistry(): CaptchaRegistry
    {
        return $this->getArgument('subject');
    }
}

The same content is in 149 releases, Joomla 5.0.0-beta3 to 6.2.1-rc1. See them all, or every version of this file.