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 /** * Copyright Magento, Inc. All rights reserved. * See COPYING.txt for license ..

Decoded Output download

<?php
/**
 * Copyright  Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
declare(strict_types=1);

namespace Magento\Bundle\Model\Sales\Order\Shipment;

use Magento\Catalog\Model\Product\Type;
use Magento\Sales\Model\ValidatorInterface;

/**
 * Validate if requested order items can be shipped according to bundle product shipment type
 */
class BundleShipmentTypeValidator implements ValidatorInterface
{
    /**
     * @inheritdoc
     */
    public function validate($item)
    {
        $result = [];
        if (!$item->isDummy(true)) {
            return $result;
        }

        $message = 'Cannot create shipment as bundle product "%1" has shipment type "%2". ' .
            '%3 should be shipped instead.';

        if ($item->getHasChildren() && $item->getProductType() === Type::TYPE_BUNDLE) {
            $result[] = __(
                $message,
                $item->getSku(),
                __('Separately'),
                __('Bundle product options'),
            );
        }

        if ($item->getParentItem() && $item->getParentItem()->getProductType() === Type::TYPE_BUNDLE) {
            $result[] = __(
                $message,
                $item->getParentItem()->getSku(),
                __('Together'),
                __('Bundle product itself'),
            );
        }

        return $result;
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php
/**
 * Copyright  Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
declare(strict_types=1);

namespace Magento\Bundle\Model\Sales\Order\Shipment;

use Magento\Catalog\Model\Product\Type;
use Magento\Sales\Model\ValidatorInterface;

/**
 * Validate if requested order items can be shipped according to bundle product shipment type
 */
class BundleShipmentTypeValidator implements ValidatorInterface
{
    /**
     * @inheritdoc
     */
    public function validate($item)
    {
        $result = [];
        if (!$item->isDummy(true)) {
            return $result;
        }

        $message = 'Cannot create shipment as bundle product "%1" has shipment type "%2". ' .
            '%3 should be shipped instead.';

        if ($item->getHasChildren() && $item->getProductType() === Type::TYPE_BUNDLE) {
            $result[] = __(
                $message,
                $item->getSku(),
                __('Separately'),
                __('Bundle product options'),
            );
        }

        if ($item->getParentItem() && $item->getParentItem()->getProductType() === Type::TYPE_BUNDLE) {
            $result[] = __(
                $message,
                $item->getParentItem()->getSku(),
                __('Together'),
                __('Bundle product itself'),
            );
        }

        return $result;
    }
}

Function Calls

None

Variables

None

Stats

MD5 0db9150c08367051526a744702769046
Eval Count 0
Decode Time 91 ms