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;
    }
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;
    }
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 ; }
Tells if a resource's method has public access

@param string          $resource Resource name
@param string|string[] $methods  Which methods to test
Default is requested method

@return boolean For success or failure
Tells if a resource s method has public access