CoreFiles by mySites.guru
AfterStoreEvent.php59 lines, 1,477 bytes, from Joomla_4.3.2-Stable-Full_Package.zip
Raw History Compare with 4.3.1
md5
ff690320ce1215447f31d6989308e664
sha1
3cf64d76090bd5ee219f34586f840d421b5aede8
sha256
a6d47959fb2c905fa4b6a9374c08340264382d2120f4a22ed0666da2bd2d0b6a
<?php

/**
 * Joomla! Content Management System
 *
 * @copyright  (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\CMS\Event\Table;

use BadMethodCallException;

// phpcs:disable PSR1.Files.SideEffects
\defined('JPATH_PLATFORM') or die;
// phpcs:enable PSR1.Files.SideEffects

/**
 * Event class for JTable's onAfterStore event
 *
 * @since  4.0.0
 */
class AfterStoreEvent extends AbstractEvent
{
    /**
     * Constructor.
     *
     * Mandatory arguments:
     * subject      JTableInterface The table we are operating on
     * result       boolean         Did the save succeed?
     *
     * @param   string  $name       The event name.
     * @param   array   $arguments  The event arguments.
     *
     * @throws  BadMethodCallException
     */
    public function __construct($name, array $arguments = [])
    {
        if (!\array_key_exists('result', $arguments)) {
            throw new BadMethodCallException("Argument 'result' is required for event $name");
        }

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

    /**
     * Setter for the result argument
     *
     * @param   boolean  $value  The value to set
     *
     * @return  boolean
     *
     * @throws  BadMethodCallException  if the argument is not of the expected type
     */
    protected function setResult($value)
    {
        return $value ? true : false;
    }
}

The same content is in 8 releases, Joomla 4.3.2-rc1 to 4.4.0-alpha2. See them all, or every version of this file.