src/Permissions/AbstractPermission.php
protected function matchesResource(Resource $resource = null)
    {
        // If the resource is null we should only return true if the current resource is also null.
        if ($resource === null) {
            return $this->getResource() === null || (
                $this->getResourceType() === null && $this->getResourceId() === null
            );
        }

        // If the permission's resource id is null then all resources with a specific ID are accepted.
        if ($this->getResourceId() === null) {
            return $this->getResourceType() === $resource->getResourceType();
        }

        // Otherwise make sure that we're matching a specific resource.
        return (
            $this->getResourceType() === $resource->getResourceType() &&
            $this->getResourceId() === $resource->getResourceId()
        );
    }
protected function matchesResource(Resource $resource = null)
    {
        // If the resource is null we should only return true if the current resource is also null.
        if ($resource === null) {
            return $this->getResource() === null || (
                $this->getResourceType() === null && $this->getResourceId() === null
            );
        }

        // If the permission's resource id is null then all resources with a specific ID are accepted.
        if ($this->getResourceId() === null) {
            return $this->getResourceType() === $resource->getResourceType();
        }

        // Otherwise make sure that we're matching a specific resource.
        return (
            $this->getResourceType() === $resource->getResourceType() &&
            $this->getResourceId() === $resource->getResourceId()
        );
    }
protected function matchesResource ( Resource $ resource = null ) { // If the resource is null we should only return true if the current resource is also null. if ( $ resource === null ) { return $ this -> getResource ( ) === null || ( $ this -> getResourceType ( ) === null && $ this -> getResourceId ( ) === null ) ; } // If the permission's resource id is null then all resources with a specific ID are accepted. if ( $ this -> getResourceId ( ) === null ) { return $ this -> getResourceType ( ) === $ resource -> getResourceType ( ) ; } // Otherwise make sure that we're matching a specific resource. return ( $ this -> getResourceType ( ) === $ resource -> getResourceType ( ) && $ this -> getResourceId ( ) === $ resource -> getResourceId ( ) ) ; }
Validate the resource

@param \BeatSwitch\Lock\Resources\Resource|null $resource
@return bool
Validate the resource