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.
*/
namespace Magento\Bundle\Model\Sales\Order\Plugin;
/**
* Plugin to calculate bundle item qty available for cancel
*/
class Item
{
/**
* Retrieve item qty available for cancel
*
* @param \Magento\Sales\Model\Order\Item $subject
* @param float|integer $result
* @return float|integer
*/
public function afterGetQtyToCancel(\Magento\Sales\Model\Order\Item $subject, $result)
{
if ($subject->getProductType() === \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE || $subject->getParentItem()
&& $subject->getParentItem()->getProductType() === \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE
) {
$qtyToCancel = $this->getQtyToCancelBundle($subject);
return max($qtyToCancel, 0);
}
return $result;
}
/**
* Retrieve item qty available for ship
*
* @param \Magento\Sales\Model\Order\Item $subject
* @param float|integer $result
* @return bool
*/
public function afterIsProcessingAvailable(\Magento\Sales\Model\Order\Item $subject, $result)
{
if ($subject->getProductType() === \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE || $subject->getParentItem()
&& $subject->getParentItem()->getProductType() === \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE
) {
return $subject->getSimpleQtyToShip() > $subject->getQtyToCancel();
}
return $result;
}
/**
* Retrieve Bundle child item qty available for cancel
* getQtyToShip() always returns 0 for BundleItems that ship together
*
* @param \Magento\Sales\Model\Order\Item $item
* @return float|integer
*/
private function getQtyToCancelBundle($item)
{
if ($item->isDummy(true)) {
return min($item->getQtyToInvoice(), $item->getSimpleQtyToShip());
}
return min($item->getQtyToInvoice(), $item->getQtyToShip());
}
}
?>
Did this file decode correctly?
Original Code
<?php
/**
* Copyright Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Bundle\Model\Sales\Order\Plugin;
/**
* Plugin to calculate bundle item qty available for cancel
*/
class Item
{
/**
* Retrieve item qty available for cancel
*
* @param \Magento\Sales\Model\Order\Item $subject
* @param float|integer $result
* @return float|integer
*/
public function afterGetQtyToCancel(\Magento\Sales\Model\Order\Item $subject, $result)
{
if ($subject->getProductType() === \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE || $subject->getParentItem()
&& $subject->getParentItem()->getProductType() === \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE
) {
$qtyToCancel = $this->getQtyToCancelBundle($subject);
return max($qtyToCancel, 0);
}
return $result;
}
/**
* Retrieve item qty available for ship
*
* @param \Magento\Sales\Model\Order\Item $subject
* @param float|integer $result
* @return bool
*/
public function afterIsProcessingAvailable(\Magento\Sales\Model\Order\Item $subject, $result)
{
if ($subject->getProductType() === \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE || $subject->getParentItem()
&& $subject->getParentItem()->getProductType() === \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE
) {
return $subject->getSimpleQtyToShip() > $subject->getQtyToCancel();
}
return $result;
}
/**
* Retrieve Bundle child item qty available for cancel
* getQtyToShip() always returns 0 for BundleItems that ship together
*
* @param \Magento\Sales\Model\Order\Item $item
* @return float|integer
*/
private function getQtyToCancelBundle($item)
{
if ($item->isDummy(true)) {
return min($item->getQtyToInvoice(), $item->getSimpleQtyToShip());
}
return min($item->getQtyToInvoice(), $item->getQtyToShip());
}
}
Function Calls
None |
Stats
MD5 | 90126be76578f5230ca9f3252447158d |
Eval Count | 0 |
Decode Time | 85 ms |