Skip to content

Commit 7f7ed16

Browse files
committed
Update HooksTrait.php
1 parent 03f38ff commit 7f7ed16

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/Help/HooksTrait.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
trait HooksTrait
1010
{
1111
/**
12-
* Вызов метода при наличии. Для хуков событий.
12+
* Вызов метода при наличии.
1313
* @param string имя метода
1414
* @param mixed аргумент метода
1515
*/
@@ -22,4 +22,19 @@ protected function hook(string $methodName, ...$methodArgs)
2222
call_user_func_array([$this, $methodName], $methodArgs);
2323
}
2424
}
25+
26+
/**
27+
* Вызов статического метода при наличии.
28+
* @param string имя метода
29+
* @param mixed аргумент метода
30+
*/
31+
protected static function staticHook(string $methodName, ...$methodArgs)
32+
{
33+
if (defined('EVAS_DEBUG') && true == EVAS_DEBUG) {
34+
echo $methodName . ('cli' == PHP_SAPI ? "\n" : '<br>');
35+
}
36+
if (method_exists(static::class, $methodName)) {
37+
call_user_func_array([static::class, $methodName], $methodArgs);
38+
}
39+
}
2540
}

0 commit comments

Comments
 (0)