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\Catalog\Model\Indexer\Product\Flat\Plugin;

use Magento\Catalog\Model\Indexer\Product\Flat\State as ProductFlatIndexerState;
use Magento\Indexer\Model\Config\Data as ConfigData;
use Magento\Catalog\Model\Indexer\Product\Flat\Processor as ProductFlatIndexerProcessor;

/**
 * Plugin for Magento\Indexer\Model\Config\Data
 */
class IndexerConfigData
{
    /**
     * @var ProductFlatIndexerState
     */
    protected $state;

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

    /**
     * Modify returned config when flat indexer is disabled
     *
     * @param ConfigData $subject
     * @param mixed $data
     * @param string $path
     * @param string $default
     * @return mixed
     *
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
     *
     */
    public function afterGet(ConfigData $subject, $data, $path = null, $default = null)
    {
        if ($this->state->isFlatEnabled()) {
            return $data;
        }

        $indexerId = ProductFlatIndexerProcessor::INDEXER_ID;

        if (!$path && isset($data[$indexerId])) {
            unset($data[$indexerId]);

            return $data;
        }

        if (!$path) {
            return $data;
        }

        list($firstKey) = explode('/', $path);

        if ($firstKey == $indexerId) {
            $data = $default;
        }

        return $data;
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php
/**
 * Copyright  Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace Magento\Catalog\Model\Indexer\Product\Flat\Plugin;

use Magento\Catalog\Model\Indexer\Product\Flat\State as ProductFlatIndexerState;
use Magento\Indexer\Model\Config\Data as ConfigData;
use Magento\Catalog\Model\Indexer\Product\Flat\Processor as ProductFlatIndexerProcessor;

/**
 * Plugin for Magento\Indexer\Model\Config\Data
 */
class IndexerConfigData
{
    /**
     * @var ProductFlatIndexerState
     */
    protected $state;

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

    /**
     * Modify returned config when flat indexer is disabled
     *
     * @param ConfigData $subject
     * @param mixed $data
     * @param string $path
     * @param string $default
     * @return mixed
     *
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
     *
     */
    public function afterGet(ConfigData $subject, $data, $path = null, $default = null)
    {
        if ($this->state->isFlatEnabled()) {
            return $data;
        }

        $indexerId = ProductFlatIndexerProcessor::INDEXER_ID;

        if (!$path && isset($data[$indexerId])) {
            unset($data[$indexerId]);

            return $data;
        }

        if (!$path) {
            return $data;
        }

        list($firstKey) = explode('/', $path);

        if ($firstKey == $indexerId) {
            $data = $default;
        }

        return $data;
    }
}

Function Calls

None

Variables

None

Stats

MD5 953eff4e2614122562625553dcb12046
Eval Count 0
Decode Time 103 ms