Jelix 1.6.40

Path
in package

Table of Contents

NORM_ADD_TRAILING_SLASH  = 1
isAbsolute()  : bool
says if the given path is an absolute one or not.
normalizePath()  : string
normalize a path : translate '..', '.', replace '\' by '/' and so on.. support windows path.
shortestPath()  : string
calculate the shortest path between two directories.
_normalizePath()  : array<string|int, mixed>
it returns components of a path after normalization, in an array.
_startNormalize()  : mixed

Constants

NORM_ADD_TRAILING_SLASH

public mixed NORM_ADD_TRAILING_SLASH = 1

Methods

isAbsolute()

says if the given path is an absolute one or not.

public static isAbsolute(string $path) : bool
Parameters
$path : string
Return values
bool

true if the path is absolute

normalizePath()

normalize a path : translate '..', '.', replace '\' by '/' and so on.. support windows path.

public static normalizePath(string $path, int $options[, string $basePath = '' ]) : string

when $path is relative, it can be resolved against the given $basePath.

Parameters
$path : string
$options : int

see NORM_* const

$basePath : string = ''
Return values
string

the normalized path

shortestPath()

calculate the shortest path between two directories.

public static shortestPath(string $from, string $to) : string
Parameters
$from : string

absolute path from which we should start

$to : string

absolute path to which we should go

Return values
string

relative path between the two path

_normalizePath()

it returns components of a path after normalization, in an array.

protected static _normalizePath(mixed $originalPath, bool $alwaysArray[, mixed $basePath = '' ]) : array<string|int, mixed>
  • first element: for windows path, the drive part "C:", "C:" etc... always in uppercase
  • second element: the normalized path. as string or array depending of $alwaysArray when as string: no trailing slash.
  • third element: indicate if the given path is an absolute path (true) or not (false)
Parameters
$originalPath : mixed
$alwaysArray : bool

if true, second element is an array

$basePath : mixed = ''
Return values
array<string|int, mixed>

_startNormalize()

protected static _startNormalize(mixed $path) : mixed
Parameters
$path : mixed
Return values
mixed

Search results