Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
DefaultNoRoute.php
Go to the documentation of this file.
1 <?php
7 
9 {
13  protected $resultPageFactory;
14 
19  public function __construct(
20  \Magento\Framework\App\Action\Context $context,
21  \Magento\Framework\View\Result\PageFactory $resultPageFactory
22  ) {
23  $this->resultPageFactory = $resultPageFactory;
24  parent::__construct($context);
25  }
26 
30  public function execute()
31  {
32  $resultLayout = $this->resultPageFactory->create();
33  $resultLayout->setStatusHeader(404, '1.1', 'Not Found');
34  $resultLayout->setHeader('Status', '404 File not found');
35  return $resultLayout;
36  }
37 }
__construct(\Magento\Framework\App\Action\Context $context, \Magento\Framework\View\Result\PageFactory $resultPageFactory)