CoreFiles by mySites.guru
GetIconEvent.php64 lines, 1,530 bytes, from Joomla_4.2.0-beta2-Beta-Full_Package.zip
Raw History Compare with 4.2.0-beta1
md5
21271febea37a10ef55002cf84aa2b77
sha1
d2b6979d8231424f8b1a4d980ffcf1470c1aedda
sha256
83d7176ced362adc2a5b1ba13a08d497c43cc87c2899a5c07d987a5a219f780d
<?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\QuickIcon;

\defined('JPATH_PLATFORM') or die;

use BadMethodCallException;
use DomainException;
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;

/**
 * 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 3 releases, Joomla 4.2.0-alpha3 to 4.2.0-beta2. See them all, or every version of this file.