CoreFiles by mySites.guru
GetIconEvent.php64 lines, 1,679 bytes, from Joomla_4.4.0-alpha3-Alpha-Full_Package.zip
Raw History Compare with 4.4.0-alpha2
md5
59933a1edd28e315b63d46982bfc7b80
sha1
13c162bc02b8e24740f6eb9108651511e2b9e047
sha256
f4f544d06c63a76cf4c1c0d339e83cf9b9891793674ac45cfc6e9db96c19ac85
<?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.txt
 */

namespace Joomla\CMS\Event\QuickIcon;

use Joomla\CMS\Event\AbstractImmutableEvent;
use Joomla\CMS\Event\ReshapeArgumentsAware;
use Joomla\CMS\Event\Result\ResultAware;
use Joomla\CMS\Event\Result\ResultAwareInterface;
use Joomla\CMS\Event\Result\ResultTypeArrayAware;

// phpcs:disable PSR1.Files.SideEffects
\defined('JPATH_PLATFORM') or die;
// phpcs:enable PSR1.Files.SideEffects

/**
 * Event class for the onGetIcon event.
 *
 * @since  4.2.0
 */
class GetIconEvent extends AbstractImmutableEvent implements ResultAwareInterface
{
    use ResultAware;
    use ResultTypeArrayAware;
    use ReshapeArgumentsAware;

    /**
     * Constructor.
     *
     * @param   string  $name       The event name.
     * @param   array   $arguments  The event arguments.
     *
     * @since   4.2.0
     * @throws  \BadMethodCallException
     */
    public function __construct(string $name, array $arguments = [])
    {
        $this->reshapeArguments($arguments, ['context']);

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

    /**
     * A method to validate the 'context' named parameter.
     *
     * @param   string  $value  The calling context for retrieving icons.
     *
     * @return  void
     *
     * @since   4.2.0
     */
    public function setContext(string $value)
    {
        if (empty($value)) {
            throw new \DomainException(sprintf("Argument 'context' of event %s must be a non-empty string.", $this->name));
        }
    }
}

The same content is in 4 releases, Joomla 4.4.0-alpha3 to 4.4.0-beta2. See them all, or every version of this file.