<?php

namespace Licenzo\Framework\Events;

class Events
{
    protected static $listeners = [];
    protected static $filters = [];
    protected static $hooks = [];
    public static function dispatch($action, $payload = []) {
        do_action("licenzo/{$action}", $payload);
    }

    public static function listen($action, $callback, $priority = 10, $acceptedArgs = 1) {
        return add_action("licenzo/{$action}", $callback, $priority, $acceptedArgs);
    }

    public static function applyFilter($filter, $value, $payload = []) {
        return apply_filters("licenzo/{$filter}", $value, $payload);
    }

    public static function addFilter($filter, $callback, $priority = 10, $acceptedArgs = 1) {
        return add_filter("licenzo/{$filter}", $callback, $priority, $acceptedArgs);
    }
}
