CoreFiles by mySites.guru
WebAssetBeforeAttachEvent.php55 lines, 1,201 bytes, from Joomla_4.0.0-alpha5-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha3
md5
4b4111670e13e8bba44a570f0f6ba9fa
sha1
f8d0d99aa518de7a225053cd1af25424f4cc264e
sha256
ae48d4a9f6abf7544185d649a04fb984409c07916c90554efc0bb24027efdcc3
<?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.txt
 */

namespace Joomla\CMS\Event\WebAsset;

defined('JPATH_PLATFORM') or die;

use BadMethodCallException;
use Joomla\CMS\Document\Document;

/**
 * Event class for WebAsset events
 *
 * @since  4.0.0
 */
class WebAssetBeforeAttachEvent extends AbstractEvent
{
	/**
	 * 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())
	{
		// Check for required arguments
		if (!array_key_exists('document', $arguments) || !($arguments['document'] instanceof Document))
		{
			throw new BadMethodCallException("Argument 'document' of event $name is not of the expected type");
		}

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

	/**
	 * Return target Document
	 *
	 * @return  Document
	 *
	 * @since   4.0.0
	 */
	public function getAsset(): Document
	{
		return $this->arguments['document'];
	}
}

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.