Add middleware lib.

This commit is contained in:
kj 2022-05-18 12:29:27 -04:00
parent f38c6610fb
commit eb27acf68e

27
src/Libs/Middleware.php Normal file
View File

@ -0,0 +1,27 @@
<?php
/**
* Middleware - DuckBrain
*
* Librería base para middlewares.
*
* @author KJ
* @website https://kj2.me
* @licence MIT
*/
namespace Libs;
class Middleware {
/**
* Llama al siguiente callback.
*
* @param Neuron $req
*
* @return mixed
*/
public static function next(Neuron $req) {
$next = array_pop($req->next);
return call_user_func_array($next, [$req]);
}
}