
Originally Posted by
3M1L
Do you mind posting your event manager class? :)
PHP Code:
<?php
declare(strict_types=1);
namespace Library\Components\Storage;
class Event {
protected $callbacks = [];
public function __construct(){}
/**
* [register is a function to register callback events]
* [MENTION=2000183830]para[/MENTION]m string $callback [The callback to register]
*/
public function register(string $callback){
$this->callbacks[] = $callback;
}
/**
* [fire is a function to fire a single or all callback events]
* [MENTION=2000183830]para[/MENTION]m string $call [The callback to fire] [Optional]
* [MENTION=850422]return[/MENTION] mixed [The respective fired callback event]
*/
public function fire(callable $call = null){
if(!$call){
foreach($this->callbacks as $callback){
call_user_func([$this, $callback]);
}
}else{
call_user_func([$this, $call]);
}
}
}
?>
Also some updates on the housekeeping, I worked a little more on the article management: