| Server IP : 54.36.91.62 / Your IP : 216.73.217.117 Web Server : Apache System : Linux webm013.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : coopiak ( 151928) PHP Version : 8.3.23 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/coopiak/amisdesseniors-fr/salondesseniors/templates/yootheme/packages/utils/src/ |
Upload File : |
<?php
namespace YOOtheme;
abstract class Hook
{
protected static ?HookCollection $collection;
/**
* Call hooks for given name.
*
* @param string|string[] $name
* @return mixed
*/
public static function call($name, callable $callback, ...$arguments)
{
return static::getCollection()->call($name, $callback, ...$arguments);
}
/**
* Add "wrap" hook for given name.
*/
public static function wrap(string $name, callable $callback): void
{
static::getCollection()->wrap($name, $callback);
}
/**
* Add "before" hook for given name.
*/
public static function before(string $name, callable $callback): void
{
static::getCollection()->before($name, $callback);
}
/**
* Add "after" hook for given name.
*/
public static function after(string $name, callable $callback): void
{
static::getCollection()->after($name, $callback);
}
/**
* Add "filter" hook for given name.
*/
public static function filter(string $name, callable $callback): void
{
static::getCollection()->filter($name, $callback);
}
/**
* Add "error" hook for given name.
*/
public static function error(string $name, callable $callback): void
{
static::getCollection()->error($name, $callback);
}
/**
* Removes hook for given name.
*/
public static function remove(string $name, callable $callback): void
{
static::getCollection()->remove($name, $callback);
}
/**
* Returns hook collection.
*/
public static function getCollection(): HookCollection
{
return static::$collection ?? (static::$collection = new HookCollection());
}
}