- md5
- d9d3aad204d5ad89d5cf328dee0f1015
- sha1
- f712783750a6d94587b841fe8c475a0475177f20
- sha256
- b2bfda6975e42258a5e8d8346c82f8295be732bacbd6a2989704d66aaa118cdc
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
<?php
/**
* Joomla! Content Management System
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace Joomla\CMS\Event\WebAsset;
defined('JPATH_PLATFORM') or die;
use BadMethodCallException;
use Joomla\CMS\Event\AbstractImmutableEvent;
use Joomla\CMS\WebAsset\WebAssetRegistry;
/**
* Event class for WebAsset events
*
* @since 4.0.0
*/
abstract class AbstractEvent extends AbstractImmutableEvent
{
/**
* Constructor.
*
* @param string $name The event name.
* @param array $arguments The event arguments.
*
* @throws BadMethodCallException
*
* @since 4.0.0
*/
public function __construct($name, array $arguments = array())
{
if (!array_key_exists('subject', $arguments))
{
throw new BadMethodCallException("Argument 'subject' of event {$this->name} is required but has not been provided");
}
parent::__construct($name, $arguments);
}
/**
* Setter for the subject argument
*
* @param WebAssetRegistry $value The value to set
*
* @return WebAssetRegistry
*
* @throws BadMethodCallException if the argument is not of the expected type
*
* @since 4.0.0
*/
protected function setSubject($value)
{
if (!$value || !($value instanceof WebAssetRegistry))
{
throw new BadMethodCallException("Argument 'subject' of event {$this->name} is not of the expected type");
}
return $value;
}
}
The same content is in 2 releases, Joomla 4.0.0-alpha5 to 4.0.0-alpha6. See them all, or every version of this file.