CoreFiles by mySites.guru
AfterRenderModulesEvent.php121 lines, 2,691 bytes, from Joomla_5.0.0-alpha4-Alpha-Full_Package.zip
Raw History Compare with 5.0.0-alpha3
md5
cc46ce9a275983a8d42c9128e586bf39
sha1
a246f01afe0d9a9a91565c184c473768d77639a3
sha256
8d09396d51c9fdf072836b8527cca4f22ba0949e8bb5e9145fdf5d065dcbd204
<?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\Module;

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

/**
 * Class for Module events.
 * Example:
 *  new AfterRenderModulesEvent('onEventName', ['subject' => $content, 'attributes' => $attrs]);
 *
 * @since  5.0.0
 */
class AfterRenderModulesEvent extends ModuleEvent
{
    /**
     * The argument names, in order expected by legacy plugins.
     *
     * @var array
     *
     * @since  5.0.0
     * @deprecated 5.0 will be removed in 6.0
     */
    protected $legacyArgumentsOrder = ['subject', 'attributes'];

    /**
     * Constructor.
     *
     * @param   string  $name       The event name.
     * @param   array   $arguments  The event arguments.
     *
     * @throws  \BadMethodCallException
     *
     * @since   5.0.0
     */
    public function __construct($name, array $arguments = [])
    {
        parent::__construct($name, $arguments);

        if (!\array_key_exists('attributes', $this->arguments)) {
            throw new \BadMethodCallException("Argument 'attributes' of event {$name} is required but has not been provided");
        }
    }

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

    /**
     * Setter for the attributes argument.
     *
     * @param   array|\ArrayAccess  $value  The value to set
     *
     * @return  array|\ArrayAccess
     *
     * @since  5.0.0
     */
    protected function setAttributes(array|\ArrayAccess $value): array|\ArrayAccess
    {
        return $value;
    }

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

    /**
     * Setter for the content.
     *
     * @param   string  $value  The value to set
     *
     * @return  self
     *
     * @since  5.0.0
     */
    public function setContent(string $value): self
    {
        $this->arguments['subject'] = $value;

        return $this;
    }

    /**
     * Getter for the attributes argument.
     *
     * @return  array|\ArrayAccess
     *
     * @since  5.0.0
     */
    public function getAttributes(): array|\ArrayAccess
    {
        return $this->arguments['attributes'];
    }
}

No other release has this exact content. See every version of this file.