Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
MatthiasMullie\PathConverter\Converter Class Reference
Inheritance diagram for MatthiasMullie\PathConverter\Converter:
MatthiasMullie\PathConverter\ConverterInterface

Public Member Functions

 __construct ($from, $to, $root='')
 
 convert ($path)
 Convert paths relative from 1 file to another.
 

Protected Member Functions

 dirname ($path)
 Attempt to get the directory name from a path.
 
 normalize ($path)
 Normalize path.
 
 shared ($path1, $path2)
 Figure out the shared path of 2 locations.
 

Protected Attributes

string $from
 
string $to
 

Constructor & Destructor Documentation

◆ __construct()

MatthiasMullie\PathConverter\Converter::__construct ( $from,
$to,
$root = '' )
Parameters
string$fromThe original base path (directory, not file!)
string$toThe new base path (directory, not file!)
string$rootRoot directory (defaults to getcwd)

Member Function Documentation

◆ convert()

MatthiasMullie\PathConverter\Converter::convert ( $path)

Convert paths relative from 1 file to another.

E.g. ../images/img.gif relative to /home/forkcms/frontend/core/layout/css should become: ../../core/layout/images/img.gif relative to /home/forkcms/frontend/cache/minified_css

Parameters
string$pathThe relative path that needs to be converted
Return values
stringThe new relative path

Implements MatthiasMullie\PathConverter\ConverterInterface.

◆ dirname()

MatthiasMullie\PathConverter\Converter::dirname ( $path)
protected

Attempt to get the directory name from a path.

Parameters
string$path
Return values
string

◆ normalize()

MatthiasMullie\PathConverter\Converter::normalize ( $path)
protected

Normalize path.

Parameters
string$path
Return values
string

◆ shared()

MatthiasMullie\PathConverter\Converter::shared ( $path1,
$path2 )
protected

Figure out the shared path of 2 locations.

Example: /home/forkcms/frontend/core/layout/images/img.gif and /home/forkcms/frontend/cache/minified_css share /home/forkcms/frontend

Parameters
string$path1
string$path2
Return values
string

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