Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Attributes
File Class Reference

Public Member Functions

 __construct ($filename, $module, ThemeInterface $theme=null, $isBase=false)
 
 getFilename ()
 
 getName ()
 
 getModule ()
 
 getTheme ()
 
 isBase ()
 
 getFileIdentifier ()
 

Protected Attributes

 $filename
 
 $module
 
 $theme
 
 $isBase
 
 $identifier
 

Detailed Description

View file in the file system with context of its identity

Definition at line 14 of file File.php.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $filename,
  $module,
ThemeInterface  $theme = null,
  $isBase = false 
)

Constructor

Parameters
string$filename
string$module
ThemeInterface$theme
bool$isBase

Definition at line 59 of file File.php.

60  {
61  $this->filename = $filename;
62  $this->module = $module;
63  $this->theme = $theme;
64  $this->isBase = $isBase;
65  }

Member Function Documentation

◆ getFileIdentifier()

getFileIdentifier ( )

Calculate unique identifier for a view file

Returns
string

Definition at line 122 of file File.php.

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  }

◆ getFilename()

getFilename ( )

Retrieve full filename

Returns
string

Definition at line 72 of file File.php.

73  {
74  return $this->filename;
75  }

◆ getModule()

getModule ( )

Retrieve fully-qualified name of a module a file belongs to

Returns
string

Definition at line 92 of file File.php.

93  {
94  return $this->module;
95  }

◆ getName()

getName ( )

Retrieve name of a file without a directory path

Returns
string

Definition at line 82 of file File.php.

83  {
84  return basename($this->filename);
85  }

◆ getTheme()

getTheme ( )

Retrieve instance of a theme a file belongs to

Returns
ThemeInterface|null

Definition at line 102 of file File.php.

103  {
104  return $this->theme;
105  }

◆ isBase()

isBase ( )

Whether file is a base one

Returns
bool

Definition at line 112 of file File.php.

113  {
114  return $this->theme === null;
115  }

Field Documentation

◆ $filename

$filename
protected

Definition at line 21 of file File.php.

◆ $identifier

$identifier
protected

Definition at line 49 of file File.php.

◆ $isBase

$isBase
protected

Definition at line 42 of file File.php.

◆ $module

$module
protected

Definition at line 28 of file File.php.

◆ $theme

$theme
protected

Definition at line 35 of file File.php.


The documentation for this class was generated from the following file: