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\Catalog\ViewModel\Product\Checker;

use Magento\Catalog\Api\Data\ProductInterface;
use Magento\Catalog\Model\Product\Attribute\Source\Status;
use Magento\CatalogInventory\Api\StockConfigurationInterface;
use Magento\Framework\View\Element\Block\ArgumentInterface;

/**
 * Check is available add to compare.
 */
class AddToCompareAvailability implements ArgumentInterface
{
    /**
     * @var StockConfigurationInterface
     */
    private $stockConfiguration;

    /**
     * @param StockConfigurationInterface $stockConfiguration
     */
    public function __construct(StockConfigurationInterface $stockConfiguration)
    {
        $this->stockConfiguration = $stockConfiguration;
    }

    /**
     * Is product available for comparison.
     *
     * @param ProductInterface $product
     * @return bool
     */
    public function isAvailableForCompare(ProductInterface $product): bool
    {
        if ((int)$product->getStatus() !== Status::STATUS_DISABLED) {
            return $product->isSalable() || $this->stockConfiguration->isShowOutOfStock();
        }

        return false;
    }
}
 ?>

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\Catalog\ViewModel\Product\Checker;

use Magento\Catalog\Api\Data\ProductInterface;
use Magento\Catalog\Model\Product\Attribute\Source\Status;
use Magento\CatalogInventory\Api\StockConfigurationInterface;
use Magento\Framework\View\Element\Block\ArgumentInterface;

/**
 * Check is available add to compare.
 */
class AddToCompareAvailability implements ArgumentInterface
{
    /**
     * @var StockConfigurationInterface
     */
    private $stockConfiguration;

    /**
     * @param StockConfigurationInterface $stockConfiguration
     */
    public function __construct(StockConfigurationInterface $stockConfiguration)
    {
        $this->stockConfiguration = $stockConfiguration;
    }

    /**
     * Is product available for comparison.
     *
     * @param ProductInterface $product
     * @return bool
     */
    public function isAvailableForCompare(ProductInterface $product): bool
    {
        if ((int)$product->getStatus() !== Status::STATUS_DISABLED) {
            return $product->isSalable() || $this->stockConfiguration->isShowOutOfStock();
        }

        return false;
    }
}

Function Calls

None

Variables

None

Stats

MD5 45e6de68082f16b6d5b8d4cea3725c09
Eval Count 0
Decode Time 96 ms