CoreFiles by mySites.guru
ResultAwareInterface.php52 lines, 1,484 bytes, from Joomla_4.2.0-beta2-Beta-Full_Package.zip
Raw History Compare with 4.2.0-beta1
md5
f4902adba053a75228172e6722b122f1
sha1
8aee3db54c5a86fb20e9497ec460e8971d2644d3
sha256
0f509a57b4ebcecff09957cd78ad59ee329ee3e71b4fc6c32ddfaaf13494a8b0
<?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\Result;

\defined('JPATH_PLATFORM') or die;

use InvalidArgumentException;

/**
 * Defines an Event which has an append-only array argument named 'result'.
 *
 * This is used for Events whose handlers are expected to return something when called, similar to
 * how many plugin events worked in earlier versions of Joomla.
 *
 * This interface is partially implemented by the ResultAware trait. The typeCheckResult method is
 * implemented by the various ResultType*Aware traits. Your event needs to use both the ResultAware
 * trait and one of the ResultType*Aware traits. For example, if your event returns boolean results
 * you need to use the ResultAware and ResultTypeBooleanAware traits in your event.
 *
 * @since 4.2.0
 */
interface ResultAwareInterface
{
	/**
	 * Appends data to the result array of the event.
	 *
	 * @param   mixed  $data  What to add to the result array.
	 *
	 * @return  void
	 * @since   4.2.0
	 */
	public function addResult($data): void;

	/**
	 * Checks the type of the data being appended to the result argument.
	 *
	 * @param   mixed  $data  The data to type check
	 *
	 * @return  void
	 * @throws  InvalidArgumentException
	 *
	 * @internal
	 * @since   4.2.0
	 */
	public function typeCheckResult($data): void;
}

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.