CoreFiles by mySites.guru
SaveEvent.php96 lines, 1,814 bytes, from Joomla_5.4.2-Stable-Full_Package.zip
Raw History Compare with 5.4.1
md5
8b33705248d87641f77c6f6050c0c4fb
sha1
befb32523d6bec05e77ea233e4a4f436e9dcd946
sha256
7898f4b2b754a8373e3d44be708648aeb5e6bb364d0ce3f4c4e09b3b3f38f7e8
<?php

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

namespace Joomla\CMS\Event\Model;

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

/**
 * Class for Model event
 *
 * @since  5.0.0
 */
abstract class SaveEvent extends ModelEvent
{
    /**
     * The argument names, in order expected by legacy plugins.
     *
     * @var array
     *
     * @since  5.0.0
     * @deprecated 5.0 will be removed in 7.0
     */
    protected $legacyArgumentsOrder = ['context', 'subject', 'isNew', 'data'];

    /**
     * Setter for the subject argument.
     *
     * @param   object  $value  The value to set
     *
     * @return  object
     *
     * @since  5.0.0
     */
    protected function onSetSubject(object $value): object
    {
        return $value;
    }

    /**
     * Setter for the isNew argument.
     *
     * @param   bool  $value  The value to set
     *
     * @return  bool
     *
     * @since  5.0.0
     */
    protected function onSetIsNew($value): bool
    {
        return (bool) $value;
    }

    /**
     * Getter for the item.
     *
     * @return  object
     *
     * @since  5.0.0
     */
    public function getItem(): object
    {
        return $this->arguments['subject'];
    }

    /**
     * Getter for the isNew state.
     *
     * @return  boolean
     *
     * @since  5.0.0
     */
    public function getIsNew(): bool
    {
        return $this->arguments['isNew'];
    }

    /**
     * Getter for the data.
     *
     * @return  array
     *
     * @since  5.0.0
     */
    public function getData()
    {
        return $this->arguments['data'];
    }
}

The same content is in 73 releases, Joomla 5.4.0-beta1 to 6.2.1-rc1. See them all, or every version of this file.