PHP Class Elgg\HooksRegistrationService

Use the elgg_* versions instead.
Since: 1.9.0
Afficher le fichier Open project: elgg/elgg Class Usage Examples

Protected Properties

Свойство Type Description
$logger Logger

Méthodes publiques

Méthode Description
backup ( ) : void Temporarily remove all event/hook registrations (before tests)
clearHandlers ( string $name, string $type ) : void Clears all handlers for a specific hook
getAllHandlers ( ) : array Returns all registered handlers as array( $name => array( $type => array( $priority => array( callback, callback, ) ) )
getOrderedHandlers ( string $name, string $type ) : callable[] Returns an ordered array of handlers registered for $name and $type.
hasHandler ( string $name, string $type ) : boolean Is a handler registered for this specific name and type? "all" handlers are not considered.
registerHandler ( $name, $type, $callback, $priority = 500 ) Registers a handler.
restore ( ) : void Restore backed up event/hook registrations (after tests)
setLogger ( Logger $logger = null ) : self Set a logger instance, e.g. for reporting uncallable handlers
unregisterHandler ( string $name, string $type, callable $callback ) : boolean Unregister a handler

Méthodes protégées

Méthode Description
getMatcher ( callable $spec ) : elgg\MethodMatcher | null Create a matcher for the given callable (if it's for a static or dynamic method)

Method Details

backup() public méthode

Call backup() before your tests and restore() after.
See also: restore
public backup ( ) : void
Résultat void

clearHandlers() public méthode

Clears all handlers for a specific hook
public clearHandlers ( string $name, string $type ) : void
$name string
$type string
Résultat void

getAllHandlers() public méthode

Returns all registered handlers as array( $name => array( $type => array( $priority => array( callback, callback, ) ) )
public getAllHandlers ( ) : array
Résultat array

getMatcher() protected méthode

Create a matcher for the given callable (if it's for a static or dynamic method)
protected getMatcher ( callable $spec ) : elgg\MethodMatcher | null
$spec callable Callable we're creating a matcher for
Résultat elgg\MethodMatcher | null

getOrderedHandlers() public méthode

Returns an ordered array of handlers registered for $name and $type.
See also: Elgg\HooksRegistrationService::getAllHandlers()
public getOrderedHandlers ( string $name, string $type ) : callable[]
$name string The name of the hook
$type string The type of the hook
Résultat callable[]

hasHandler() public méthode

If you need to consider "all" handlers, you must check them independently, or use (bool)elgg_get_ordered_hook_handlers().
public hasHandler ( string $name, string $type ) : boolean
$name string The name of the hook
$type string The type of the hook
Résultat boolean

registerHandler() public méthode

Registers a handler.
public registerHandler ( $name, $type, $callback, $priority = 500 )

restore() public méthode

Restore backed up event/hook registrations (after tests)
See also: backup
public restore ( ) : void
Résultat void

setLogger() public méthode

Set a logger instance, e.g. for reporting uncallable handlers
public setLogger ( Logger $logger = null ) : self
$logger Logger The logger
Résultat self

unregisterHandler() public méthode

Unregister a handler
public unregisterHandler ( string $name, string $type, callable $callback ) : boolean
$name string
$type string
$callback callable
Résultat boolean

Property Details

$logger protected_oe property

protected Logger,Elgg $logger
Résultat Logger