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\CatalogGraphQl\Model\Category;

use Magento\Framework\App\ResourceConnection;
use Magento\Catalog\Model\ResourceModel\Category;

/**
 * Determine level data for GraphQL Category request
 */
class LevelCalculator
{
    /**
     * @var ResourceConnection
     */
    private $resourceConnection;

    /**
     * @var Category
     */
    private $resourceCategory;

    /**
     * @param ResourceConnection $resourceConnection
     * @param Category $resourceCategory
     */
    public function __construct(
        ResourceConnection $resourceConnection,
        Category $resourceCategory
    ) {
        $this->resourceConnection = $resourceConnection;
        $this->resourceCategory = $resourceCategory;
    }

    /**
     * Calculate level data for root category ID specified in GraphQL request
     *
     * @param int $rootCategoryId
     * @return int
     */
    public function calculate(int $rootCategoryId) : int
    {
        $connection = $this->resourceConnection->getConnection();
        $select = $connection->select()
            ->from($this->resourceConnection->getTableName('catalog_category_entity'), 'level')
            ->where($this->resourceCategory->getEntityIdField() . " = ?", $rootCategoryId);

        return (int) $connection->fetchOne($select);
    }
}
 ?>

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\CatalogGraphQl\Model\Category;

use Magento\Framework\App\ResourceConnection;
use Magento\Catalog\Model\ResourceModel\Category;

/**
 * Determine level data for GraphQL Category request
 */
class LevelCalculator
{
    /**
     * @var ResourceConnection
     */
    private $resourceConnection;

    /**
     * @var Category
     */
    private $resourceCategory;

    /**
     * @param ResourceConnection $resourceConnection
     * @param Category $resourceCategory
     */
    public function __construct(
        ResourceConnection $resourceConnection,
        Category $resourceCategory
    ) {
        $this->resourceConnection = $resourceConnection;
        $this->resourceCategory = $resourceCategory;
    }

    /**
     * Calculate level data for root category ID specified in GraphQL request
     *
     * @param int $rootCategoryId
     * @return int
     */
    public function calculate(int $rootCategoryId) : int
    {
        $connection = $this->resourceConnection->getConnection();
        $select = $connection->select()
            ->from($this->resourceConnection->getTableName('catalog_category_entity'), 'level')
            ->where($this->resourceCategory->getEntityIdField() . " = ?", $rootCategoryId);

        return (int) $connection->fetchOne($select);
    }
}

Function Calls

None

Variables

None

Stats

MD5 57b0e6425e5f49b7a3e5c7ea5e16808d
Eval Count 0
Decode Time 122 ms