This commit is contained in:
Bastian Allgeier
2019-01-14 10:52:45 +01:00
parent 01277f79f2
commit 8070893b64
22 changed files with 482 additions and 351 deletions

View File

@@ -177,16 +177,7 @@ class App
public function apply(string $name, $value)
{
if ($functions = $this->extension('hooks', $name)) {
static $applied = [];
foreach ($functions as $function) {
if (in_array($function, $applied[$name] ?? []) === true) {
continue;
}
// mark the hook as triggered, to avoid endless loops
$applied[$name][] = $function;
// bind the App object to the hook
$value = $function->call($this, $value);
}