Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php declare (strict_types=1); namespace OneTeamSoftware\WC\Shipping; use OneTeamS..

Decoded Output download

<?php 
declare (strict_types=1); 
 
namespace OneTeamSoftware\WC\Shipping; 
 
use OneTeamSoftware\Logger\LoggerInterface; 
use OneTeamSoftware\ShippingCarrier\AbstractAdapter\AdapterInterface; 
use OneTeamSoftware\WC\Shipping\Builder\ShipmentBuilder; 
 
class ApiRatesFinder extends AbstractRatesFinder 
{ 
    protected $adapter; 
    protected $shipmentBuilder; 
    protected $mediaMail; 
    protected $displayDeliveryTime; 
    protected $displayTrackingType; 
    protected $requireCompanyName; 
    protected $requireCountry; 
    protected $requireCity; 
    protected $requirePostalCode; 
    protected $requireAddress; 
 
    public function __construct(string $ZLNlC, AdapterInterface $Ko9CP, ShipmentBuilder $osTTO, LoggerInterface $MM3oL, array $dK4bD = []) 
    { 
        $this->adapter = $Ko9CP; 
        $this->shipmentBuilder = $osTTO; 
        $this->mediaMail = null; 
        $this->displayDeliveryTime = false; 
        $this->displayTrackingType = false; 
        $this->requireCompanyName = false; 
        $this->requireCountry = false; 
        $this->requireCity = false; 
        $this->requirePostalCode = false; 
        $this->requireAddress = false; 
        parent::__construct($ZLNlC, $MM3oL, $dK4bD); 
    } 
 
    public function setSettings(array $dK4bD): void 
    { 
        parent::setSettings($dK4bD); 
    } 
 
    public function findShippingRates(array $xECMj): array 
    { 
        $this->logger->debug(__FILE__, 122, "findShippingRates"); 
        if ($this->requireCountry && empty($xECMj["destination"]["country"])) { 
            $this->error = __("Destination country is required", $this->id); 
            $this->logger->debug(__FILE__, 126, "Destination country is required"); 
            return []; 
        } 
        if ($this->requireCity && empty($xECMj["destination"]["city"])) { 
            $this->error = __("Destination city is required", $this->id); 
            $this->logger->debug(__FILE__, 133, "Destination city is required"); 
            return []; 
        } 
        if ($this->requirePostalCode && empty($xECMj["destination"]["postcode"])) { 
            $this->error = __("Destination postal code is required", $this->id); 
            $this->logger->debug(__FILE__, 140, "Destination postal code is required"); 
            return []; 
        } 
        if ($this->requireAddress && empty($xECMj["destination"]["address"])) { 
            $this->error = __("Destination address is required", $this->id); 
            $this->logger->debug(__FILE__, 147, "Destination address is required"); 
            return []; 
        } 
        if (empty($xECMj["weight"])) { 
            $this->error = __("Parcel weight must be larger than 0", $this->id); 
            $this->logger->debug(__FILE__, 154, "Parcel weight must be larger than 0"); 
            return []; 
        } 
        if ($this->requireCompanyName && empty($xECMj["destination"]["company"])) { 
            $xECMj["destination"]["company"] = __("Company Name Is Missing", $this->id); 
            $this->logger->debug(__FILE__, 162, "Company name is required but missing, so add fake company name, so we can get rates"); 
        } 
        $ekOtT = isset($xECMj["mediaMail"]) ? $xECMj["mediaMail"] : $this->mediaMail; 
        if (false === empty($ekOtT) && $ekOtT === "only") { 
            $xECMj["mediaMail"] = $ekOtT; 
        } else { 
            $xECMj["mediaMail"] = false; 
        } 
        $Hdu1c = $this->getPackageShippingRates($xECMj); 
        if (false === empty($ekOtT) && $ekOtT === "include") { 
            $xECMj["mediaMail"] = $ekOtT; 
            $HfRJf = $this->getPackageShippingRates($xECMj); 
            if (false === empty($HfRJf)) { 
                $Hdu1c = array_replace_recursive($HfRJf, $Hdu1c); 
            } 
        } 
        return $Hdu1c; 
    } 
 
    private function getPackageShippingRates(array $xECMj): array 
    { 
        $this->logger->debug(__FILE__, 195, "getPackageShippingRates: %s", print_r($xECMj, true)); 
        $this->error = null; 
        $this->validationErrors = []; 
        $LRMXf = $this->shipmentBuilder->build(array_merge($this->settings, $xECMj)); 
        $aMQL8 = $this->adapter->getRates($LRMXf)->wait(); 
        if (false === empty($aMQL8["validation_errors"])) { 
            $this->validationErrors = $aMQL8["validation_errors"]; 
        } 
        if (false === empty($aMQL8["messages"]) && is_array($aMQL8["messages"])) { 
            $this->error = current($aMQL8["messages"]); 
        } 
        if (!isset($aMQL8["shipment"]["rates"])) { 
            $this->logger->debug(__FILE__, 212, "No rates have been found"); 
            return []; 
        } 
        $Hdu1c = $aMQL8["shipment"]["rates"] ?? []; 
        $this->logger->debug(__FILE__, 219, "rates: %s", print_r($Hdu1c, true)); 
        return $Hdu1c; 
    } 
} 
 ?>

Did this file decode correctly?

Original Code

<?php
declare (strict_types=1);

namespace OneTeamSoftware\WC\Shipping;

use OneTeamSoftware\Logger\LoggerInterface;
use OneTeamSoftware\ShippingCarrier\AbstractAdapter\AdapterInterface;
use OneTeamSoftware\WC\Shipping\Builder\ShipmentBuilder;

class ApiRatesFinder extends AbstractRatesFinder
{
    protected $adapter;
    protected $shipmentBuilder;
    protected $mediaMail;
    protected $displayDeliveryTime;
    protected $displayTrackingType;
    protected $requireCompanyName;
    protected $requireCountry;
    protected $requireCity;
    protected $requirePostalCode;
    protected $requireAddress;

    public function __construct(string $ZLNlC, AdapterInterface $Ko9CP, ShipmentBuilder $osTTO, LoggerInterface $MM3oL, array $dK4bD = [])
    {
        $this->adapter = $Ko9CP;
        $this->shipmentBuilder = $osTTO;
        $this->mediaMail = null;
        $this->displayDeliveryTime = false;
        $this->displayTrackingType = false;
        $this->requireCompanyName = false;
        $this->requireCountry = false;
        $this->requireCity = false;
        $this->requirePostalCode = false;
        $this->requireAddress = false;
        parent::__construct($ZLNlC, $MM3oL, $dK4bD);
    }

    public function setSettings(array $dK4bD): void
    {
        parent::setSettings($dK4bD);
    }

    public function findShippingRates(array $xECMj): array
    {
        $this->logger->debug(__FILE__, 122, "\146\151\156\x64\x53\150\x69\160\160\x69\x6e\x67\x52\x61\x74\145\163");
        if ($this->requireCountry && empty($xECMj["\144\x65\163\x74\x69\x6e\x61\164\151\x6f\x6e"]["\143\157\x75\156\x74\x72\171"])) {
            $this->error = __("\x44\145\x73\x74\151\156\x61\164\x69\157\x6e\x20\143\x6f\165\156\164\x72\171\40\151\163\x20\162\x65\x71\x75\x69\162\145\x64", $this->id);
            $this->logger->debug(__FILE__, 126, "\104\x65\x73\x74\151\x6e\x61\x74\x69\157\x6e\40\143\157\x75\156\164\x72\171\x20\x69\163\40\162\145\161\x75\151\162\x65\144");
            return [];
        }
        if ($this->requireCity && empty($xECMj["\144\145\x73\x74\151\x6e\x61\164\151\157\156"]["\143\x69\164\171"])) {
            $this->error = __("\104\x65\x73\x74\x69\156\141\164\x69\157\156\x20\143\x69\164\171\x20\x69\163\x20\162\x65\161\x75\x69\162\x65\144", $this->id);
            $this->logger->debug(__FILE__, 133, "\x44\x65\163\164\x69\x6e\x61\164\x69\x6f\156\40\x63\151\164\171\40\x69\163\x20\162\145\161\165\151\162\x65\144");
            return [];
        }
        if ($this->requirePostalCode && empty($xECMj["\144\145\163\x74\151\x6e\x61\164\x69\157\x6e"]["\160\x6f\x73\164\143\157\144\x65"])) {
            $this->error = __("\x44\145\x73\x74\151\156\x61\x74\151\157\x6e\40\160\157\x73\164\x61\x6c\40\143\157\144\x65\x20\x69\x73\40\x72\145\161\165\151\x72\x65\144", $this->id);
            $this->logger->debug(__FILE__, 140, "\x44\145\x73\x74\151\156\x61\164\x69\157\x6e\x20\x70\157\163\x74\141\x6c\40\143\x6f\x64\145\40\x69\163\x20\x72\x65\x71\x75\151\162\145\144");
            return [];
        }
        if ($this->requireAddress && empty($xECMj["\144\x65\163\164\x69\156\x61\164\151\x6f\x6e"]["\141\x64\x64\x72\x65\163\163"])) {
            $this->error = __("\x44\x65\163\164\x69\x6e\x61\x74\151\x6f\x6e\x20\141\144\x64\x72\x65\163\x73\40\x69\163\40\162\x65\161\165\151\162\145\144", $this->id);
            $this->logger->debug(__FILE__, 147, "\104\x65\163\x74\x69\x6e\x61\164\151\x6f\156\40\141\x64\x64\162\x65\x73\163\40\x69\163\x20\162\145\161\165\151\x72\x65\x64");
            return [];
        }
        if (empty($xECMj["\x77\145\151\147\150\x74"])) {
            $this->error = __("\120\141\x72\x63\x65\154\40\x77\x65\x69\x67\x68\x74\40\x6d\x75\x73\164\40\142\145\40\154\x61\x72\147\145\162\x20\x74\150\141\156\40\60", $this->id);
            $this->logger->debug(__FILE__, 154, "\120\141\162\x63\145\x6c\40\x77\x65\151\x67\150\x74\x20\155\x75\163\x74\x20\142\x65\x20\154\x61\x72\147\145\162\40\x74\x68\x61\156\x20\60");
            return [];
        }
        if ($this->requireCompanyName && empty($xECMj["\x64\145\x73\x74\x69\x6e\x61\164\x69\x6f\156"]["\143\157\x6d\160\141\156\x79"])) {
            $xECMj["\144\x65\163\164\151\156\141\164\x69\x6f\x6e"]["\x63\x6f\155\x70\141\x6e\x79"] = __("\x43\x6f\x6d\160\141\156\171\40\x4e\x61\x6d\145\40\x49\163\x20\x4d\x69\163\x73\x69\x6e\147", $this->id);
            $this->logger->debug(__FILE__, 162, "\103\x6f\x6d\x70\141\156\x79\x20\156\141\x6d\145\40\151\163\x20\162\145\x71\x75\151\x72\145\x64\x20\142\x75\x74\40\155\x69\163\163\x69\156\147\x2c\40\163\x6f\x20\141\x64\144\x20\x66\x61\x6b\x65\x20\143\157\155\160\141\156\x79\x20\x6e\x61\x6d\x65\54\40\163\157\40\x77\145\40\143\141\156\x20\x67\x65\164\40\x72\x61\164\x65\163");
        }
        $ekOtT = isset($xECMj["\x6d\145\x64\x69\141\x4d\x61\x69\154"]) ? $xECMj["\155\145\144\x69\x61\115\141\x69\x6c"] : $this->mediaMail;
        if (false === empty($ekOtT) && $ekOtT === "\157\156\x6c\x79") {
            $xECMj["\155\145\x64\151\x61\x4d\x61\x69\154"] = $ekOtT;
        } else {
            $xECMj["\x6d\145\144\151\x61\115\x61\x69\154"] = false;
        }
        $Hdu1c = $this->getPackageShippingRates($xECMj);
        if (false === empty($ekOtT) && $ekOtT === "\x69\x6e\x63\x6c\165\x64\145") {
            $xECMj["\x6d\145\144\151\x61\x4d\141\x69\154"] = $ekOtT;
            $HfRJf = $this->getPackageShippingRates($xECMj);
            if (false === empty($HfRJf)) {
                $Hdu1c = array_replace_recursive($HfRJf, $Hdu1c);
            }
        }
        return $Hdu1c;
    }

    private function getPackageShippingRates(array $xECMj): array
    {
        $this->logger->debug(__FILE__, 195, "\x67\x65\x74\x50\x61\143\153\141\x67\145\x53\x68\151\x70\x70\151\156\147\122\x61\164\145\x73\72\40\x25\x73", print_r($xECMj, true));
        $this->error = null;
        $this->validationErrors = [];
        $LRMXf = $this->shipmentBuilder->build(array_merge($this->settings, $xECMj));
        $aMQL8 = $this->adapter->getRates($LRMXf)->wait();
        if (false === empty($aMQL8["\166\x61\x6c\151\144\141\x74\x69\157\x6e\137\x65\162\x72\157\162\163"])) {
            $this->validationErrors = $aMQL8["\x76\x61\x6c\x69\144\141\x74\x69\157\156\137\x65\162\162\x6f\x72\163"];
        }
        if (false === empty($aMQL8["\155\x65\x73\163\141\x67\x65\163"]) && is_array($aMQL8["\155\x65\163\163\x61\x67\145\x73"])) {
            $this->error = current($aMQL8["\x6d\x65\x73\x73\141\x67\x65\x73"]);
        }
        if (!isset($aMQL8["\163\x68\151\160\x6d\145\156\164"]["\162\141\x74\145\163"])) {
            $this->logger->debug(__FILE__, 212, "\116\x6f\40\162\141\164\145\x73\40\150\141\x76\x65\40\142\145\145\x6e\x20\146\x6f\x75\156\x64");
            return [];
        }
        $Hdu1c = $aMQL8["\163\x68\151\x70\x6d\145\156\164"]["\162\x61\x74\x65\163"] ?? [];
        $this->logger->debug(__FILE__, 219, "\x72\141\164\x65\163\72\x20\x25\x73", print_r($Hdu1c, true));
        return $Hdu1c;
    }
}

Function Calls

None

Variables

None

Stats

MD5 14bfc0bf1df4af4a239ec2443e3457bb
Eval Count 0
Decode Time 55 ms