@param null  $resource
@param array $files

@return mixed|null
776083
public function execute($resource = null, array $files = array())
    {
        $this->populateCDNResources();

        $urls = [];
        foreach ($files as $file) {
            $urls[] = '/' . urlencode($file);
        }

        $cdnResources = array_filter($this->cdnResources, function($value, $key) use ($resource) {
            return $value['cname'] == $resource;
        }, ARRAY_FILTER_USE_BOTH);

        foreach ($cdnResources as $cdnResource) {
            $this->client->post($this->url, [
                'form_params' => [
                    'cdn_id' => $cdnResource['id'],
                    'login' => $this->login,
                    'passwd' => $this->password,
                    'url' => $urls
                ]
            ]);
        }

        return;
    }
285936
public function load($resource)
    {
        $jsonDecoder = new JsonDecoder();
        $jsonDecoder->setObjectDecoding(JsonDecoder::ASSOC_ARRAY);

        $config = $jsonDecoder->decode($this->repository->get($resource)->getBody());

        // Keep track of this file being loaded to prevent infinite recursion
        $this->loadedFiles[$resource] = true;

        $this->includeDesc($config);
        $this->mergeIncludes($config);

        return $config;
    }
334503
protected function createResourceOutput(?array $resources) : ?string
    {
        if (empty($resources)) {
            return null;
        }

        $output = [];

        foreach ($resources as $resource) {
            $str = <<<'SCRIPTSTR'
<script type="application/javascript" src="{{url}}"{{async}}{{defer}}{{integ}}{{cors}}></script>
SCRIPTSTR;

            $output[] = Str::format($str, [
                'url'   => $this->parseOutputUrl($resource->url, $resource->filename),
                'async' => $resource->async ? ' async' : null,
                'defer' => $resource->defer ? ' defer' : null,
                'integ' => $resource->integrity !== null ? ' integrity="' . $resource->integrity . '"' : null,
                'cors'  => $resource->crossorigin !== null ? ' crossorigin="' . $resource->crossorigin . '"' : null,
            ]);
        }

        return implode("\n", $output);
    }
921109
public function load($resource, $type = null)
    {
        $path = $this->locator->locate($resource);
        $this->container->addResource(new FileResource($path));

        $file = new JsonFile($path);
        $content = $file->read();
        $extension = pathinfo($resource, PATHINFO_FILENAME);

        if (array_key_exists('parameters', $content)) {
            foreach ($content['parameters'] as $name => $parameter) {
                $this->container->setParameter($name, $parameter);
            }

            unset($content['parameters']);
        }

        if (array_key_exists('imports', $content)) {
            foreach ($content['imports'] as $import) {
                $importFilename = $import;
                if (!Path::isAbsolute($importFilename)) {
                    $importFilename = Path::join([dirname($path), $import]);
                }

                $this->import($importFilename, null, false, $file);
            }

            unset($content['imports']);
        }

        $this->container->loadFromExtension($extension, $content);
    }
1323376
protected function createResourceOutput(?array $resources) : ?string
    {
        if (empty($resources)) {
            return null;
        }

        $extra = [];

        foreach ($resources as $attr => $value) {
            $extra[] = e($attr) . '="' . e($value) . '"';
        }

        return implode(' ', $extra);
    }
872301
protected function doLoad(array $files, $extends = null)
    {
        $filename = array_shift($files);
        $content = $this->loadFile($filename);

        $key = '';
        if (isset($content['extends@'])) {
            $key = 'extends@';
        } elseif (isset($content['@extends'])) {
            $key = '@extends';
        } elseif (isset($content['@extends@'])) {
            $key = '@extends@';
        }

        $override = (bool)$extends;
        $extends = (array)($key && !$extends ? $content[$key] : $extends);

        unset($content['extends@'], $content['@extends'], $content['@extends@']);

        $data = $extends ? $this->doExtend($filename, $files, $extends, $override) : [];
        $data[] = $content;

        return $data;
    }
1329564
public function getResourceUrl($resource)
    {
        Assert::oneOf(
            $resource,
            self::getResourcesNames(),
            'Resource type "%s" is not supported by the ACME server (supported: %2$s)'
        );

        return isset($this->serverResources[$resource]) ? $this->serverResources[$resource] : null;
    }
783494
public function setResources($resources) {

		if(false === is_array($resources)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type array, "%s" given', __METHOD__, gettype($resources)), E_USER_ERROR);
		}

		$this -> resources = $resources;
	}
641546
public function parseResource($resource)
    {
        $pluginId = $file = null;
        if (isset($resource[0]) && $resource[0] == '@') {
            list($pluginId, $file) = explode('/', $resource, 2);
            $pluginId = substr($pluginId, 1);
        }

        // @deprecated
        if (strpos($resource, ':') !== false) {
            wei()->logger->warning('deprecated view', $resource);
            list($pluginId, $file) = explode(':', $resource, 2);
        }

        if ($pluginId) {
            $plugin = $this->getOneById($pluginId);
            $path = $plugin->getBasePath() . '/resources';

            return ['path' => $path, 'file' => $file];
        } else {
            return ['path' => null, 'file' => $resource];
        }
    }
428812
protected function filterFiles(array $files)
    {
        $files = parent::filterFiles($files);

        if (! class_exists('Illuminate\Http\UploadedFile')) {
            // The \Illuminate\Http\UploadedFile class was introduced in Laravel 5.2.15,
            // so don't change the $files array if it does not exist.
            return $files;
        }

        return $this->convertToTestFiles($files);
    }
1221707
public function load($resource, $type = null)
    {
        $resource = (string) $resource;

        if (!is_file($resource)) {
            throw new InvalidArgumentException(sprintf('File "%s" is not a regular file.', $resource));
        }

        if (!is_readable($resource)) {
            throw new InvalidArgumentException(sprintf('File "%s" is not readable.', $resource));
        }

        $content = file_get_contents($resource);
        $decoded = @json_decode($content, true);

        if ($decoded === null) {
            throw new InvalidArgumentException(
                sprintf('File "%s" cannot be json decode (error code: %s).', $resource, json_last_error())
            );
        }

        return $decoded;
    }
484220
public static function getFirstExistingFileArray($files = [])
    {
        foreach ($files as $file) {
            if (file_exists(\Yii::getAlias($file))) {
                return $file;
            }
        }

        return null;
    }
1038602
public static function files(string $key = null)
    {
        if (!isset($_FILES[$key])) {
            return null;
        }
        if (is_array($_FILES[$key]['name'])) {
            return self::getFileObjects($key);
        } else {
            return new filesystem\UploadedFile($_FILES);
        }
    }
70085
public static function create( $resource, $params=null )
    {
        self::_validateCall('create', $params);
        $requestor = new ApiRequestor();
        $url = '/' . $resource;
        return $requestor->request( 'post', $url, $params );
    }
584037
private function setResources($resources)
    {
        if (!$resources instanceof ResourcesInterface) {
            $files = (array)$resources;
            $resources = new Resources;

            array_walk($files, [$resources, 'addFileResource']);
        }

        $this->resources = $resources;
    }
1126784
public function getAsciiContentPath(string $resource)
    {
        if (null === $this->container->getParameter('ascii')) {
            return null;
        }

        $paths = $this->container->getParameter('ascii');
        if (!array_key_exists($resource, $paths)) {
            return null;
        }

        // Deal with multiple ascii files by returning one at random.
        if (\is_array($paths[$resource])) {
            shuffle($paths[$resource]);
            return reset($paths[$resource]);
        }

        return $paths[$resource];
    }
91218
private function copy(File $resource, File $file)
    {
        $ds = DIRECTORY_SEPARATOR;
        $hash = $this->getHash($resource);

        $file->setSize($resource->getSize());
        $file->setName($resource->getName());
        $file->setMimeType($resource->getMimeType());
        $file->setHashName($hash);
        copy($this->filesDir.$ds.$resource->getHashName(), $this->filesDir.$ds.$hash);

        return $file;
    }