Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/old/vendor/magento/module-shipping/Model/Rate/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/magento/module-shipping/Model/Rate/CarrierResult.php
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

declare(strict_types=1);

namespace Magento\Shipping\Model\Rate;

/**
 * Processed rates received from a carrier.
 */
class CarrierResult extends Result
{
    /**
     * @var Result[][]
     */
    private $results = [];

    /**
     * Append result received from a carrier.
     *
     * @param Result $result
     * @param bool $appendFailed Append result's errors as well.
     * @return void
     */
    public function appendResult(Result $result, bool $appendFailed): void
    {
        $this->results[] = ['result' => $result, 'appendFailed' => $appendFailed];
    }

    /**
     * @inheritDoc
     */
    public function getAllRates()
    {
        $needsSorting = false;
        //Appending previously received results.
        while ($resultData = array_shift($this->results)) {
            if ($resultData['result']->getError()) {
                if ($resultData['appendFailed']) {
                    $this->append($resultData['result']);
                    $needsSorting = true;
                }
            } else {
                $this->append($resultData['result']);
                $needsSorting = true;
            }
        }
        if ($needsSorting) {
            parent::sortRatesByPrice();
        }

        return parent::getAllRates();
    }

    /**
     * @inheritDoc
     */
    public function getError()
    {
        $this->getAllRates();

        return parent::getError();
    }

    /**
     * @inheritDoc
     */
    public function getRateById($id)
    {
        $this->getAllRates();

        return parent::getRateById($id);
    }

    /**
     * @inheritDoc
     */
    public function getCheapestRate()
    {
        $this->getAllRates();

        return parent::getCheapestRate();
    }

    /**
     * @inheritDoc
     */
    public function getRatesByCarrier($carrier)
    {
        $this->getAllRates();

        return parent::getRatesByCarrier($carrier);
    }

    /**
     * @inheritDoc
     */
    public function asArray()
    {
        $this->getAllRates();

        return parent::asArray();
    }

    /**
     * @inheritDoc
     */
    public function sortRatesByPrice()
    {
        $this->getAllRates();

        return parent::sortRatesByPrice();
    }

    /**
     * @inheritDoc
     */
    public function updateRatePrice($packageCount)
    {
        $this->getAllRates();

        return parent::updateRatePrice($packageCount);
    }
}

Spamworldpro Mini