protected function isPublic(string $resource, $methods = null)
    {
        if (($this->authentication ?? null) === null) {
            return true;
        }

        $resource_data = $this->resources[$resource] ?? null;
        if ($resource_data === null) {
            return false;
        }

        $public = $resource_data['public'] ?? $this->default_publicity;
        if (is_string($public)) {
            $public = [$public];
        }

        $methods = (array) ($methods ?? $this->method);

        return (is_array($public))
            ? !empty(array_intersect($public, $methods))
            : (bool) $public;
    }