Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
DocRootLocator.php
Go to the documentation of this file.
1 <?php
7 namespace Magento\Framework\App;
8 
11 
16 {
20  private $request;
21 
25  private $readFactory;
26 
31  public function __construct(RequestInterface $request, ReadFactory $readFactory)
32  {
33  $this->request = $request;
34  $this->readFactory = $readFactory;
35  }
36 
42  public function isPub()
43  {
44  $rootBasePath = $this->request->getServer('DOCUMENT_ROOT');
45  $readDirectory = $this->readFactory->create(DirectoryList::ROOT);
46  return (substr($rootBasePath, -strlen('/pub')) === '/pub') && !$readDirectory->isExist($rootBasePath . 'setup');
47  }
48 }
__construct(RequestInterface $request, ReadFactory $readFactory)