@param FileResource[] $resources

@return bool
966604
public function isFresh(array $resources)
    {
        if (!file_exists($this->file)) {
            return false;
        }

        $timestamp = filemtime($this->file);

        foreach ($resources as $resource) {
            if ($resource instanceof FileResource && $timestamp < $resource->getMetadata()->getModificationTime()) {
                return false;
            }
        }

        return true;
    }
437345
public function loadFiles($files)
    {
        $files = (array) $files;

        $success = true;
        foreach ($files as $file) {

            $this->loadFile($file);
        }
        return true;
    }
198743
public function deleteResource(PersistentResource $resource)
    {
        $this->s3Client->deleteObject(array(
            'Bucket' => $this->bucketName,
            'Key' => $this->keyPrefix . $resource->getSha1()
        ));
        return true;
    }
724496
public static function deletePermissionsForResource($resources)
    {
        $resources = is_array($resources) ? $resources : [$resources];
        $result    = 0;

        foreach ($resources as $resource) {
            foreach (static::allPermissionsFor($resource) as $name) {
                PermissionProxy::where(['name' => $name])->delete();
                $result++;
            }
        }

        app(PermissionRegistrar::class)->forgetCachedPermissions();

        return $result;
    }
1118991
public function canSubresourceMultiple($subresources, $action) : bool {
		if (!is_array($subresources)) {
			$subresources = [$subresources];
		}
		foreach ($subresources as $v) {
			if (!$this->canSubresourceCached($v, $action)) {
				return false;
			}
		}
		return true;
	}
1177211
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];
    }
505500
protected function applyLock($resource)
    {
        if ($this->shouldLock === false) {
            $this->lockApplied = false;
            return flock($resource, LOCK_UN);
        }

        $lock = $this->shouldLock === true ? $this->getLockMode() : $this->shouldLock;


        if (!flock($resource, $lock)) {
            return false;
        }

        $this->lockApplied = true;

        return true;
    }
485595
public function setResource ($name, $resource)
	{
		
		// Get the resource
		
		$obj	=& Sonic::getResource ($resource);
		
		if (!$obj)
		{
			return FALSE;
		}
		
		// Set resource object
		
		$this->setResourceObj ($name, $obj);
		
		// Return
		
		return TRUE;
		
	}
795491
public final function resourceCheck(File $file) {
        if ($this->resourcePathMatch($file)) {
            if (is_null($this->getParentProject()->getResourceByFile($file)) && !is_null($resource = $this->resourceFactory($file))) {
                $this->getParentProject()->registerResource($resource);
            }
            return TRUE;
        } else {
            return FALSE;
        }
    }
1130556
protected function checkSupports($ext, $resource)
    {
        if (!is_string($resource)) {
            return false;
        }

        $info = pathinfo($resource);
        $extension = $info['extension'];

        if ('dist' === $extension) {
            $extension = pathinfo($info['filename'], PATHINFO_EXTENSION);
        }

        if (is_string($ext)) {
            return ($ext === $extension);
        }

        if (is_array($ext)) {
            $supported = false;

            foreach ($ext as $value) {
                if ($value === $extension) {
                    $supported = true;
                    break;
                }
            }

            return $supported;
        }

        return false;
    }
1372192
private function loadImports(array $resources)
    {
        foreach ($resources as $resource) {
            if (!is_string($resource)) {
                continue;
            }

            $this->import($resource);
        }
    }
1206346
protected function setOnResource(array $methods)
    {
        if ( count($methods) <= 2
            && array_filter($methods, function($item) { return is_callable($item); }) 
        )
            ##! 'on_resource' => ['dump_debug' => function($resource) {k($resource);}]
            $methods = array($methods);

        foreach($methods as $method) {
            $name = null;
            if (is_array($method)) {
                if (count($method) === 2) {
                    ##! ['method_name', \Closure]
                    $name = $method[0]; $fn = $method[1];
                } elseif (array_values($method) !== $method) {
                    ##! ['method_name' => \Closure]
                    $name = key($method);
                    $fn = current($method);
                }
            }

            if ($name === null)
                throw new \InvalidArgumentException(
                    'Unknown Method Type Provided For '.\Poirot\Std\flatten($method)
                );

            $this->onResourceAvailable()->addMethod($name, $fn);
        }
    }
478148
public static function fromResources(ResourceInterface ...$resources) {
		$collectionDocument = new self();
		
		foreach ($resources as $resource) {
			$collectionDocument->addResource($resource);
		}
		
		return $collectionDocument;
	}
442632
protected function externalHandler(Resource $resource)
    {
        $handlers = $this->resources[$resource->name]['handlers'] ?? [];

        if (!empty($handlers)) {
            if ($this->safe_method) {
                $handlers = $handlers['GET'] ?? null;
                if (is_array($handlers)) {
                    $handlers = $this->getAvailableTypes($resource->name);
                    $type = $resource->content_type;
                }
            } else {
                $handlers = $handlers[$this->method] ?? null;
                if (is_array($handlers)) {
                    $type = $resource->payload['mime'];
                }
            }

            if (isset($type)) {
                $handler = $handlers[$type];
                if (is_array($handler)) {
                    $handler = $handler[$resource->kind];
                }
                if ($type === 'application/json' && $handler == '__DEFAULT__') {
                    $handler = null;
                }
            } else {
                $handler = $handlers;
            }

            if ($handler !== null) {
                if (is_callable($handler)) {
                    if ($this->method === 'HEAD') {
                        ob_start();
                        $handler($resource);
                        ob_end_clean();
                    } else {
                        $handler($resource);
                        flush();
                    }
                    return true;
                }
                $this->sendError(static::ERROR_INTERNAL_SERVER, sprintf(
                    "Resource '%s' has invalid %s handler: '%s' (%s request)",
                    $resource->name,
                    $this->method,
                    $handler,
                    $resource->kind
                ));
            }
        }

        return false;
    }
404432
protected function sortResources($resources)
    {
        if ($sortBy = config('health.sort_by')) {
            return $resources->sortBy(function ($resource) use ($sortBy) {
                return $this->handleExceptions(function () use (
                    $resource,
                    $sortBy
                ) {
                    return
                        ($resource->isGlobal ? 'a-' : 'z-').$resource->$sortBy;
                });
            });
        }

        return $resources;
    }
1132606
public function transform(FilesystemResource $resource)
    {
        $config = json_decode($resource->getBody(), true);
        return $this->validateConfig($config) ? $config : [];
    }
577378
public function resources(array $resources)
    {
        foreach ($resources as $name => $resource) {
            $options = [];

            if (\is_array($resource)) {
                list($resource, $options) = $resource;
            }

            $this->resource($name, $resource, $options);
        }
    }