class Autoloader

Class Autoloader XELOS Autoloader for loading XELOS related class files Supporting XELOS Namespaces as well as a Fallback for files without namespace (XELOS < 7.0, DEPRECIATED)

Constants

TYPE_PSR_0

TYPE_PSR_4

Properties

static array $file_prefix

File Prefixes used by XELOS in front of module name

static string $ns_prefix

XELOS Namespace Prefix

static array $classmap_cache

Lookup Cache

static array $modules_cache

Module Cache

static array $class_is_loaded

Loaded Classes

static array $class_alias

Class Alias Lookup

static bool $composer_autoloader_loaded

Identifies if the Composer Autoloader has already been loaded

static string[] $alias_blacklist

Problematic ClassNames which are conflicting with PHP internals or Major Extensions (e.g. PEAR)

Methods

static 
clear_cache()

Forces all Code Caches to Reload (Classmap, OPCache,...) Should be called after a Code Deployment to enforce Revalidation

static 
composer_autoload_error_handler()

Error Handler to catch Fatal Error during Composer Autoload Init

static string
from_camel_case(string $input, bool $without_ns = true)

Returns the passed name in underscore writing (TestClass --> test_class)

static array
getClassInfoFromNS(string $class_name_with_ns)

Returns module_name, vendor, path for XELOS Namespace

static bool|string
get_class_path(string $class_name, array $data = array())

Returns the HDD filepath for the passed class

static bool|string
get_classmap_path_from_ns(string $class_name_with_ns)

Returns the base path for the classmap based on the XELOS namespaced path

static string
get_module_name_from_path(string $path)

Extracts the module name from the full hdd path

static mixed
get_modules(bool $cached = true)

Returns a list of all modules in the module and vendor/*module/ path

static string
get_ns_from_path($path, $return_class_name = false)

Extracts a full file path to a file namespace based on the path components if possible

static bool|string
get_path_from_ns(string $class_name_with_ns)

Returns the base path for the classmap based on the XELOS namespaced path

static void
load_class(string $class_name)

Require Class File

static mixed
load_class_file(string $class_file)

Loads the passed class file

static array|bool
lookup_classname_from_classmap($class_name, bool $additional_paths = false)

Returns all Classmap Details for the given class name

static 
register()

Register Required Autoloaders

static 
register_composer_loader(bool $load_class = false)

Register COMPOSER Autoloader

static string
to_camel_case($input)

Returns the passed name from underscore writing to CamelCase (test_class --> TestClass) Warning: Converting back to CamelCase is not unique in all cases! e.g. SystemDMS can not be regenerated from system_dms

Details

at line 834
static clear_cache()

Forces all Code Caches to Reload (Classmap, OPCache,...) Should be called after a Code Deployment to enforce Revalidation

at line 108
static composer_autoload_error_handler()

Error Handler to catch Fatal Error during Composer Autoload Init

at line 343
static string from_camel_case(string $input, bool $without_ns = true)

Returns the passed name in underscore writing (TestClass --> test_class)

Parameters

string $input
bool $without_ns

Return Value

string

at line 580
static array getClassInfoFromNS(string $class_name_with_ns)

Returns module_name, vendor, path for XELOS Namespace

Parameters

string $class_name_with_ns

Return Value

array

at line 194
static bool|string get_class_path(string $class_name, array $data = array())

Returns the HDD filepath for the passed class

Parameters

string $class_name

string

array $data

Return Value

bool|string

at line 537
static bool|string get_classmap_path_from_ns(string $class_name_with_ns)

Returns the base path for the classmap based on the XELOS namespaced path

Parameters

string $class_name_with_ns

Return Value

bool|string

at line 758
static string get_module_name_from_path(string $path)

Extracts the module name from the full hdd path

Parameters

string $path

Return Value

string

String of module or false if not found

at line 705
static mixed get_modules(bool $cached = true)

Returns a list of all modules in the module and vendor/*module/ path

Parameters

bool $cached

Return Value

mixed

at line 783
static string get_ns_from_path($path, $return_class_name = false)

Extracts a full file path to a file namespace based on the path components if possible

Parameters

$path
$return_class_name

Return Value

string

at line 566
static bool|string get_path_from_ns(string $class_name_with_ns)

Returns the base path for the classmap based on the XELOS namespaced path

Parameters

string $class_name_with_ns

Return Value

bool|string

at line 127
static void load_class(string $class_name)

Require Class File

The Lookup Logic consists of multiple stages, whereby the fastest method is used first:

  1. Try to lookup via ClassMap (This is the fastest version as it doesn't require any file operation, cached between requests)
  2. Try to lookup file via fallback method (Using manual dir check if NS is present)
  3. Fallback using PHP Include Path Scan (stream_resolve_include_path)

Parameters

string $class_name

Name of the Class to Load (PHP Autoloader)

Return Value

void

at line 180
static mixed load_class_file(string $class_file)

Loads the passed class file

Parameters

string $class_file

Return Value

mixed

at line 234
static array|bool lookup_classname_from_classmap($class_name, bool $additional_paths = false)

Returns all Classmap Details for the given class name

Parameters

$class_name
bool $additional_paths

Additional paths to load classmap of

Return Value

array|bool

at line 73
static register()

Register Required Autoloaders

at line 85
static register_composer_loader(bool $load_class = false)

Register COMPOSER Autoloader

Parameters

bool $load_class

at line 368
static string to_camel_case($input)

Returns the passed name from underscore writing to CamelCase (test_class --> TestClass) Warning: Converting back to CamelCase is not unique in all cases! e.g. SystemDMS can not be regenerated from system_dms

Parameters

$input

Return Value

string