public function hasResource($resource)
    {
        if (!isset($this->resourcesCached[$resource])) {
            if (isset($this->resources[$resource])) {
                $this->resourcesCached[$resource] = $this->resources[$resource];
            } else {
                $found = false;
                foreach ($this->resources as $resourceName) {
                    $regex = str_replace(
                        array("\*", "\?"), // wildcard chars
                        array('.*', '.'),   // regexp chars
                        preg_quote($resourceName)
                    );

                    if (preg_match('/^' . $regex . '$/is', $resource)) {
                        $found = true;
                    }
                }

                $this->resourcesCached[$resource] = $found;
            }
        }

        return $this->resourcesCached[$resource];
    }