[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * Joomla! Content Management System 5 * 6 * @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org> 7 * @license GNU General Public License version 2 or later; see LICENSE 8 */ 9 10 namespace Joomla\CMS\Event\Table; 11 12 use BadMethodCallException; 13 use Joomla\CMS\Event\AbstractImmutableEvent; 14 use Joomla\CMS\Table\TableInterface; 15 16 // phpcs:disable PSR1.Files.SideEffects 17 \defined('JPATH_PLATFORM') or die; 18 // phpcs:enable PSR1.Files.SideEffects 19 20 /** 21 * Event class for the Table's events 22 * 23 * @since 4.0.0 24 */ 25 abstract class AbstractEvent extends AbstractImmutableEvent 26 { 27 /** 28 * @param string $name The event name. 29 * @param array $arguments The event arguments. 30 * 31 * @throws BadMethodCallException 32 * 33 * @since 1.0 34 */ 35 public function __construct($name, array $arguments = []) 36 { 37 if (!\array_key_exists('subject', $arguments)) { 38 throw new BadMethodCallException("Argument 'subject' of event {$this->name} is required but has not been provided"); 39 } 40 41 parent::__construct($name, $arguments); 42 } 43 44 /** 45 * Setter for the subject argument 46 * 47 * @param TableInterface $value The value to set 48 * 49 * @return TableInterface 50 * 51 * @throws BadMethodCallException If the argument is not of the expected type. 52 */ 53 protected function setSubject($value) 54 { 55 if (!\is_object($value) || !($value instanceof TableInterface)) { 56 throw new BadMethodCallException("Argument 'subject' of event {$this->name} is not of the expected type"); 57 } 58 59 return $value; 60 } 61 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |