Constants

T_FUNCTION

T_FUNCTION

Symbol types

T_CONSTANT

T_CONSTANT

T_CLASS

T_CLASS

T_EXTENSION

T_EXTENSION

F_SCRIPT

F_SCRIPT

Target types

F_EXTENSION

F_EXTENSION

F_PACKAGE

F_PACKAGE

NO_AUTOLOAD

NO_AUTOLOAD

Autoloader ignores maps loaded with this flag

CRC_CHECK

CRC_CHECK

Check CRC

PECL_LOAD

PECL_LOAD

Load is done by the PECL extension - Reserved for internal use

Properties

$type_strings

$type_strings : array

Type

array — Fixed value array containing a readable string for each symbol/target type

$failureHandlers

$failureHandlers : \Automap\array(callables)

Type

\Automap\array(callables) — Registered failure handlers

$successHandlers

$successHandlers : \Automap\array(callables)

Type

\Automap\array(callables) — Registered success handlers

$supportConstantAutoload

$supportConstantAutoload : boolean

Type

boolean — Whether the PHP engine is able to autoload constants

$supportFunctionAutoload

$supportFunctionAutoload : boolean

Type

boolean — Whether the PHP engine is able to autoload functions

$maps

$maps : \Automap\array(<map

Type

\Automap\array(

$load_index

$load_index : integer

Type

integer — The map ID of the next map load

Methods

init()

init() 

Undocumented - Internal use only

registerFailureHandler()

registerFailureHandler(callable  $callable) : null

Register a failure handler

Once registered, the failure handler is called each time a symbol resolution fails.

There is no limit on the number of failure handlers that can be registered.

Handlers cannot be unregistered.

Parameters

callable $callable

Returns

null

registerSuccessHandler()

registerSuccessHandler(callable  $callable) : null

Register a success handler

Once registered, the success handler is called each time a symbol resolution succeeds.

The success handler receives two arguments : An array as returned by the getSymbol() method, and the ID of the map where the symbol was found.

There is no limit on the number of success handlers that can be registered.

Handlers cannot be unregistered.

Parameters

callable $callable

Returns

null

key()

key(string  $type, string  $name) : string

Combines a type and a symbol in a 'key'

Starting with version 3.0, Automap is fully case-sensitive. This allows for higher performance and cleaner code.

Do not use: access reserved for Automap classes

Parameters

string $type

one of the 'T_' constants

string $name

The symbol value (case sensitive)

Returns

string —

Symbol key

typeToString()

typeToString(  $type) 

Parameters

$type

stringToType()

stringToType(  $string) 

Parameters

$string

isActiveID()

isActiveID(integer  $id) : boolean

Checks if a map ID is active (if it corresponds to a loaded map)

Parameters

integer $id

ID to check

Returns

boolean

map()

map(string  $id) : \Automap\Map

Returns the \Automap\Map object corresponding to an active map ID

Parameters

string $id

The map ID

Throws

\Exception

if map ID is invalid

Returns

\Automap\Map

instance

activeIDs()

activeIDs() : array

Returns the list of currently active IDs.

Returns

array

load()

load(string  $path, integer  $flags, string  $_bp = null) : integer

Loads a map file and returns its ID.

Parameters

string $path

The path of the map file to load

integer $flags

Load flags

string $_bp

Reserved for internal operations. Never set this param.

Returns

integer —

the map ID

unload()

unload(string  $id) : null

Unloads a map

We dont use __destruct because :

  1. We don't want this to be called on script shutdown
  2. Exceptions cannot be caught when sent from a destructor.

If the input ID is invalid, it is silently ignored.

Parameters

string $id

The map ID to unload

Returns

null

usingAccelerator()

usingAccelerator() 

autoloadHook()

autoloadHook(string  $name,   $type = self::T_CLASS) 

The autoload handler

Reserved for internal use

Parameters

string $name

Symbol name

$type

getFunction()

getFunction(  $name) 

Parameters

$name

getConstant()

getConstant(  $name) 

Parameters

$name

getClass()

getClass(  $name) 

Parameters

$name

getExtension()

getExtension(  $name) 

Parameters

$name

requireFunction()

requireFunction(  $name) 

Parameters

$name

requireConstant()

requireConstant(  $name) 

Parameters

$name

requireClass()

requireClass(  $name) 

Parameters

$name

requireExtension()

requireExtension(  $name) 

Parameters

$name

callFailureHandlers()

callFailureHandlers(string  $type, string  $name) : null

Call every registered failure handlers

Call provides two arguments : the symbol type (one of the 'T_' constants) and the symbol name.

Handlers are called in registration order.

Parameters

string $type

one of the 'T_' constants

string $name

The symbol name

Returns

null

callSuccessHandlers()

callSuccessHandlers(  $entry,   $id) 

Parameters

$entry
$id

validate()

validate(integer  $id) : integer

Same as isActiveID() but throws an exception if the map ID is invalid

Returns the map ID so that it can be embedded in a call string.

Parameters

integer $id

ID to check

Throws

\Exception

if the ID is invalid (not loaded)

Returns

integer —

ID (not modified)

symbolIsDefined()

symbolIsDefined(  $type,   $name) 

Parameters

$type
$name

resolve()

resolve(string  $type, string  $name, boolean  $autoloading = false, boolean  $exception = false) : true

Resolve a symbol

, i.e. load what needs to be loaded for the symbol to be defined.

In order to optimize the PHK case, maps are searched in reverse order (newest first).

Warning: Autoload mechanism is not reentrant. This function cannot reference an unknow class (like \Phool\Display).

Parameters

string $type

Symbol type

string $name

Symbol name

boolean $autoloading

Whether this was called by the PHP autoloader

boolean $exception

Whether we must throw an exception if the resolution fails

Throws

\Exception

Returns

true —

on success / false if unable to resolve symbol