HumHub Documentation (unofficial)

Autoload
in package

Autoloader, which is fully compatible with PSR-4, and can be used to autoload your `Helper`, `Page`, and `Step` classes.

Table of Contents

Properties

$map  : array<string|int, mixed>
An associative array where the key is a namespace prefix and the value is an array of base directories for classes in that namespace.
$registered  : mixed

Methods

addNamespace()  : void
Adds a base directory for a namespace prefix.
load()  : mixed
loadMappedFile()  : mixed
Load the mapped file for a namespace prefix and relative class.
requireFile()  : mixed
__construct()  : mixed

Properties

$map

An associative array where the key is a namespace prefix and the value is an array of base directories for classes in that namespace.

protected static array<string|int, mixed> $map = []

$registered

protected static mixed $registered = false

Methods

addNamespace()

Adds a base directory for a namespace prefix.

public static addNamespace(string $prefix, string $base_dir[, bool $prepend = false ]) : void

Example:

<?php
// app\Codeception\UserHelper will be loaded from '/path/to/helpers/UserHelper.php'
Autoload::addNamespace('app\Codeception', '/path/to/helpers');

// LoginPage will be loaded from '/path/to/pageobjects/LoginPage.php'
Autoload::addNamespace('', '/path/to/pageobjects');

Autoload::addNamespace('app\Codeception', '/path/to/controllers');
?>
Parameters
$prefix : string

The namespace prefix.

$base_dir : string

A base directory for class files in the namespace.

$prepend : bool = false

If true, prepend the base directory to the stack instead of appending it; this causes it to be searched first rather than last.

load()

public static load(mixed $class) : mixed
Parameters
$class : mixed

loadMappedFile()

Load the mapped file for a namespace prefix and relative class.

protected static loadMappedFile(string $prefix, string $relative_class) : mixed
Parameters
$prefix : string

The namespace prefix.

$relative_class : string

The relative class name.

Return values
mixed

Boolean false if no mapped file can be loaded, or the name of the mapped file that was loaded.

requireFile()

protected static requireFile(mixed $file) : mixed
Parameters
$file : mixed

__construct()

private __construct() : mixed

        
On this page

Search results