public function matchesResource($resource) { $resource = is_object($resource) ? get_class($resource) : $resource; return $this->resource === $resource || $this->resource === 'all'; }