Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e604d19eb1 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1 @@
|
||||
vendor
|
||||
composer.lock
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"name": "Arsen Mirzaev Tatyano-Muradovich",
|
||||
"email": "arsen@mirzaev.sexy",
|
||||
"homepage": "https://mirzaev.sexy",
|
||||
"role": "Creator"
|
||||
"role": "Programmer"
|
||||
}
|
||||
],
|
||||
"support": {
|
||||
@@ -24,13 +24,6 @@
|
||||
"require": {
|
||||
"php": "~8.4"
|
||||
},
|
||||
"suggest": {
|
||||
"mirzaev/baza": "Baza database",
|
||||
"mirzaev/pot": "Template for projects",
|
||||
"mirzaev/files": "Easy working with files",
|
||||
"mirzaev/languages": "Easy languages integration",
|
||||
"mirzaev/currencies": "Easy currencies integration"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"mirzaev\\minimal\\": "mirzaev/minimal/system"
|
||||
|
||||
2320
composer.lock
generated
Executable file
2320
composer.lock
generated
Executable file
File diff suppressed because it is too large
Load Diff
@@ -34,7 +34,7 @@ use Closure as closure,
|
||||
* @param model $model An instance of the model
|
||||
* @param router $router An instance of the router
|
||||
*
|
||||
* @method void __construct(?string $namespace) Constructor
|
||||
* @mathod void __construct(?string $namespace) Constructor
|
||||
* @method void __destruct() Destructor
|
||||
* @method string|null start() Initialize request by environment and handle it
|
||||
* @method string|null request(request $request, array $parameters = []) Handle request
|
||||
@@ -103,7 +103,9 @@ final class core
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
public function __destruct() {}
|
||||
public function __destruct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Start
|
||||
|
||||
@@ -10,9 +10,7 @@ use mirzaev\minimal\http\request,
|
||||
mirzaev\minimal\route;
|
||||
|
||||
// Built-in libraries
|
||||
use Closure as closure,
|
||||
LogicException as exception_logic
|
||||
;
|
||||
use Closure as closure;
|
||||
|
||||
/**
|
||||
* Middleware
|
||||
@@ -28,14 +26,14 @@ use Closure as closure,
|
||||
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
|
||||
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
|
||||
*/
|
||||
class middleware
|
||||
final class middleware
|
||||
{
|
||||
/**
|
||||
* Function
|
||||
*
|
||||
* @var closure|array $function Function
|
||||
* @var closure $function Function
|
||||
*/
|
||||
public readonly closure|array $function;
|
||||
public readonly closure $function;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@@ -44,28 +42,10 @@ class middleware
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(?closure $function = null)
|
||||
public function __construct(closure $function)
|
||||
{
|
||||
if (static::class === self::class) {
|
||||
// The middleware class itself
|
||||
|
||||
// Writing the function
|
||||
$this->function = $function;
|
||||
} else {
|
||||
// The middleware inheriting class
|
||||
|
||||
if (method_exists($this, 'middleware')) {
|
||||
// Found the method
|
||||
|
||||
// Writing the function
|
||||
$this->function = [$this, 'middleware'];
|
||||
} else {
|
||||
// Not found the method
|
||||
|
||||
// Exit (fail)
|
||||
throw new exception_logic('The middleware method is not initialized', 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user