SALT main class

package salt

 Methods

Add a folder to the class autoload mecanism.

addClassFolder(string $folder, string $namespace = NULL, string $pattern = '.class.php'
Static

Parameters

$folder

string

root folder that contain classes

$namespace

string

(Optional, NULL) Namespace to use for register classes

$pattern

string

(Optional, .class.php) Suffix of files that contains classes

Return the relative path between two folders.

computeRelativePath(string $from, string $dest, integer $destIgnoreLevel = 0) : string
Static

Parameters can be provided with a file or ends with / (or )
All characters after the last / (or ) is ignored

Parameters

$from

string

Origin path

$dest

string

Destination path

$destIgnoreLevel

integer

(Optional, 0) Ignore some folders at the end of the destination path

Exceptions

\Exception If the origin and destination paths are not both relative or absolute path

Returns

stringRelative path for go to $dest from $from. Return always ends with /, except if empty

Load SALT configuration

config() 
Static

Load a class

loadClass(string $className) 
Static

Parameters

$className

string

Class name with namespace to load

Exceptions

\salt\SaltException if the class don't exists in folders added with self::addClassFolder()

Retrieve relative path from executed PHP script to method caller

relativePath(integer $destIgnoreLevel = 0) : string
Static

Parameters

$destIgnoreLevel

integer

(Optionnel, 0) Ignore some folders at the end of the method caller

Returns

stringRelative path between executed PHP script and method caller

Return absolute SALT path

saltPath() : string
Static

Returns

stringabsolute SALT path

Retrieve relative path from request URI to method caller

webRelativePath(integer $destIgnoreLevel = 0) : string
Static

Parameters

$destIgnoreLevel

integer

(Optionnel, 0) Ignore some folders at the end of the method caller

Returns

stringRelative path between requested URI and method caller (usefull for URI rewrite)

Deep walk in a folder for find files that contains classes

findAllClasses(string $folder, string $namespace = NULL, string $pattern = '.class.php') : array<mixed,string>
Static

Parameters

$folder

string

Folder to inspect

$namespace

string

(Optional, NULL) Namespace to use

$pattern

string

(Optional, .class.php) Suffix to use for filter files

Returns

array<mixed,string>List or found files as ( Namespace\ClassName => FilePath )

 Properties

 

all classes that can be loaded by our autoload : namespace\class => /full/class/path

$ALL_CLASSES : array<mixed,string>

Default

array()
Static