[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/src/Event/Result/ -> ResultAwareInterface.php (source)

   1  <?php
   2  
   3  /**
   4   * Joomla! Content Management System
   5   *
   6   * @copyright  (C) 2022 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\Result;
  11  
  12  use InvalidArgumentException;
  13  
  14  // phpcs:disable PSR1.Files.SideEffects
  15  \defined('JPATH_PLATFORM') or die;
  16  // phpcs:enable PSR1.Files.SideEffects
  17  
  18  /**
  19   * Defines an Event which has an append-only array argument named 'result'.
  20   *
  21   * This is used for Events whose handlers are expected to return something when called, similar to
  22   * how many plugin events worked in earlier versions of Joomla.
  23   *
  24   * This interface is partially implemented by the ResultAware trait. The typeCheckResult method is
  25   * implemented by the various ResultType*Aware traits. Your event needs to use both the ResultAware
  26   * trait and one of the ResultType*Aware traits. For example, if your event returns boolean results
  27   * you need to use the ResultAware and ResultTypeBooleanAware traits in your event.
  28   *
  29   * @since 4.2.0
  30   */
  31  interface ResultAwareInterface
  32  {
  33      /**
  34       * Appends data to the result array of the event.
  35       *
  36       * @param   mixed  $data  What to add to the result array.
  37       *
  38       * @return  void
  39       * @since   4.2.0
  40       */
  41      public function addResult($data): void;
  42  
  43      /**
  44       * Checks the type of the data being appended to the result argument.
  45       *
  46       * @param   mixed  $data  The data to type check
  47       *
  48       * @return  void
  49       * @throws  InvalidArgumentException
  50       *
  51       * @internal
  52       * @since   4.2.0
  53       */
  54      public function typeCheckResult($data): void;
  55  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer