Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
File.php
Go to the documentation of this file.
1 <?php
7 namespace Magento\Framework\View;
8 
10 
14 class File
15 {
21  protected $filename;
22 
28  protected $module;
29 
35  protected $theme;
36 
42  protected $isBase;
43 
49  protected $identifier;
50 
59  public function __construct($filename, $module, ThemeInterface $theme = null, $isBase = false)
60  {
61  $this->filename = $filename;
62  $this->module = $module;
63  $this->theme = $theme;
64  $this->isBase = $isBase;
65  }
66 
72  public function getFilename()
73  {
74  return $this->filename;
75  }
76 
82  public function getName()
83  {
84  return basename($this->filename);
85  }
86 
92  public function getModule()
93  {
94  return $this->module;
95  }
96 
102  public function getTheme()
103  {
104  return $this->theme;
105  }
106 
112  public function isBase()
113  {
114  return $this->theme === null;
115  }
116 
122  public function getFileIdentifier()
123  {
124  if (null === $this->identifier) {
125  $theme = $this->getTheme() ? ('|theme:' . $this->theme->getFullPath()) : '';
126  $this->identifier = ($this->isBase ? 'base' : '')
127  . $theme . '|module:' . $this->getModule() . '|file:' . $this->getName();
128  }
129  return $this->identifier;
130  }
131 }
__construct($filename, $module, ThemeInterface $theme=null, $isBase=false)
Definition: File.php:59