-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGate.php
50 lines (46 loc) · 1.23 KB
/
Gate.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php declare(strict_types = 1);
namespace noxkiwi\core;
use noxkiwi\core\Interfaces\GateInterface;
use noxkiwi\singleton\Singleton;
/**
* I am the Gate class. My purpose is to either let a user pass or not.
* The Gate class is utilized before asking a Policy class since it checks for
* - System compatability
* - Services' status
* - CSRF check
* - Network checks (CIDR and IP whitelist)
*
* Contrary to the Auth layer, a Gate is used to check any other variable the Request provides
* to either let the user pass or deny the access.
* For example have a look at the MaintenanceGate.
* Other well working Gate objects are bound to network structure and date/time restrictions.
*
* @package noxkiwi\core
* @author Jan Nox <[email protected]>
* @license https://nox.kiwi/license
* @copyright 2018 noxkiwi
* @version 1.0.0
* @link https://nox.kiwi/
*/
abstract class Gate extends Singleton implements GateInterface
{
/**
* @inheritDoc
*/
public function isOpen(): bool
{
return true;
}
/**
* @inheritDoc
*/
public function open(): void
{
}
/**
* @inheritDoc
*/
public function close(?string $reason = null): void
{
}
}