Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/old/vendor/magento/module-developer/Console/Command/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/magento/module-developer/Console/Command/TemplateHintsStatusCommand.php
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
declare(strict_types=1);

namespace Magento\Developer\Console\Command;

use Magento\Framework\App\Config\ReinitableConfigInterface;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\Console\Cli;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

/**
 * Command to show frontend template hints status
 */
class TemplateHintsStatusCommand extends Command
{
    const COMMAND_NAME = 'dev:template-hints:status';
    const TEMPLATE_HINTS_STOREFRONT_PATH = 'dev/debug/template_hints_storefront';

    /**
     * @var ScopeConfigInterface
     */
    private $scopeConfig;

    /**
     * @var ReinitableConfigInterface
     */
    private $reinitableConfig;

    /**
     * Initialize dependencies.
     *
     * @param ScopeConfigInterface $scopeConfig
     * @param ReinitableConfigInterface $reinitableConfig
     */
    public function __construct(
        ScopeConfigInterface $scopeConfig,
        ReinitableConfigInterface $reinitableConfig
    ) {
        parent::__construct();
        $this->scopeConfig = $scopeConfig;
        $this->reinitableConfig = $reinitableConfig;
    }

    /**
     * @inheritdoc
     */
    public function configure()
    {
        $this->setName(self::COMMAND_NAME)
            ->setDescription('Show frontend template hints status.');

        parent::configure();
    }

    /**
     * @inheritdoc
     * @throws \InvalidArgumentException
     */
    public function execute(InputInterface $input, OutputInterface $output)
    {
        $this->reinitableConfig->reinit();
        $templateHintsStatus =
            ($this->isTemplateHintsEnabled())
                ? 'enabled'
                : 'disabled';
        $templateHintsMessage = __("Template hints are %status", ['status' => $templateHintsStatus]);
        $output->writeln("<info>$templateHintsMessage</info>");

        return Cli::RETURN_SUCCESS;
    }

    /**
     * Check if template hints enabled
     *
     * @return bool
     */
    private function isTemplateHintsEnabled(): bool
    {
        return $this->scopeConfig->isSetFlag(self::TEMPLATE_HINTS_STOREFRONT_PATH, 'default');
    }
}

Spamworldpro Mini