Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Static Public Member Functions
FileResolver Class Reference

Public Member Functions

 getFile ($class)
 
 getFilePath ($class)
 

Static Public Member Functions

static addIncludePath ($path, $prepend=true)
 

Detailed Description

Contains logic for finding class filepaths based on include_path configuration.

Definition at line 11 of file FileResolver.php.

Member Function Documentation

◆ addIncludePath()

static addIncludePath (   $path,
  $prepend = true 
)
static

Add specified path(s) to the current include_path

Parameters
string | array$path
bool$prependWhether to prepend paths or to append them
Returns
void

Definition at line 43 of file FileResolver.php.

44  {
45  $includePathExtra = implode(PATH_SEPARATOR, (array)$path);
46  $includePath = get_include_path();
47  $pathSeparator = $includePath && $includePathExtra ? PATH_SEPARATOR : '';
48  if ($prepend) {
49  $includePath = $includePathExtra . $pathSeparator . $includePath;
50  } else {
51  $includePath = $includePath . $pathSeparator . $includePathExtra;
52  }
53  set_include_path($includePath);
54  }

◆ getFile()

getFile (   $class)

Find a file in include path. Include path is set in composer.json or with set_include_path()

Parameters
string$class
Returns
string|bool

Definition at line 19 of file FileResolver.php.

20  {
22  return stream_resolve_include_path($relativePath);
23  }
$_option $_optionId $class
Definition: date.phtml:13
$relativePath
Definition: get.php:35

◆ getFilePath()

getFilePath (   $class)

Get relative file path for specified class

Parameters
string$class
Returns
string

Definition at line 31 of file FileResolver.php.

32  {
33  return ltrim(str_replace(['_', '\\'], '/', $class), '/') . '.php';
34  }
$_option $_optionId $class
Definition: date.phtml:13

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