![]() 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/cartforge.co/vendor/magento/module-swagger/Controller/Index/ |
<?php /*** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); namespace Magento\Swagger\Controller\Index; use Magento\Framework\App\Action\Action; use Magento\Framework\App\Action\Context; use Magento\Framework\App\Action\HttpGetActionInterface; use Magento\Framework\App\ObjectManager; use Magento\Framework\App\RequestInterface; use Magento\Framework\Exception\NotFoundException; use Magento\Framework\View\Page\Config as PageConfig; use Magento\Framework\View\Result\PageFactory as PageFactory; use Magento\Swagger\Model\Config; class Index extends Action implements HttpGetActionInterface { /** * @var PageConfig */ private $pageConfig; /** * @var PageFactory */ private $pageFactory; /** * @var Config */ private $config; /** * @param Context $context * @param PageConfig $pageConfig * @param PageFactory $pageFactory * @param Config|null $config */ public function __construct( Context $context, PageConfig $pageConfig, PageFactory $pageFactory, ?Config $config = null ) { parent::__construct($context); $this->pageConfig = $pageConfig; $this->pageFactory = $pageFactory; $this->config = $config ?? ObjectManager::getInstance() ->get(Config::class); } /** * @inheritDoc */ public function execute() { $this->pageConfig->addBodyClass('swagger-section'); return $this->pageFactory->create(); } /** * @inheritDoc */ public function dispatch(RequestInterface $request) { if (!$this->config->isEnabled()) { throw new NotFoundException(__('Page not found.')); } return parent::dispatch($request); } }