Psecio\Gatekeeper\Gatekeeper::restrict PHP Method

restrict() public static method

Create a restriction and add it to be evaluated
public static restrict ( string $type, array $config )
$type string Restriction type
$config array Restriction configuration
    public static function restrict($type, array $config)
    {
        $classNs = '\\Psecio\\Gatekeeper\\Restrict\\' . ucwords(strtolower($type));
        if (!class_exists($classNs)) {
            throw new \InvalidArgumentException('Restriction type "' . $type . '" is invalid');
        }
        $instance = new $classNs($config);
        self::$restrictions[] = $instance;
    }