AuthComponent::check PHP Method

check() private method

check for authentication or authorization
private check ( array $config, string $type ) : boolean
$config array
$type string
return boolean
    private function check($config, $type)
    {
        if (empty($config)) {
            throw new Exception($type . ' methods arent initialized yet in config');
        }
        $auth = Utility::normalize($config);
        foreach ($auth as $method => $config) {
            $method = "_" . ucfirst($method) . ucfirst($type);
            if (!method_exists(__CLASS__, $method)) {
                throw new Exception('Auth Method doesnt exists: ' . $method);
            }
            if ($this->{$method}($config) === false) {
                return false;
            }
        }
        return true;
    }