@param null $resource

@return mixed|null
@throws QueryErrorException
504814
public function execute($resource = null)
    {
        if (null === $resource) {
            throw new QueryErrorException('Could not delete no resource');
        }

        $this->populateCDNResources();

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

        if (count($cdnResources) > 1) {
            throw new QueryErrorException('Could not delete more than one resource');
        }

        foreach ($cdnResources as $cdnResource) {
            $response = $this->client->post($this->url, [
                'form_params' => [
                    'id' => $cdnResource['id'],
                    'login' => $this->login,
                    'passwd' => $this->password,
                ]
            ]);
            $data = json_decode($response->getBody()->getContents(), true);

            if ('ok' !== $data['status']) {
                throw new QueryErrorException(json_encode($data));
            }
        }

        return;
    }
1088582
public function assertResourceFound($resource, array $criteria)
    {
        \PHPUnit_Framework_Assert::assertNotNull(
            $result = $this->findResource($resource, $criteria),
            sprintf('The resource "%s" could not be found. (%s)', $resource, json_encode($criteria))
        );

        return $result;
    }
1126791
public function formClass($resource=null)
    {

        $resource = $this->passedOrCurrent($resource);

        if ($formClass = $this->mapper->formClass($resource)) {
            return $formClass;
        }

        $modelClass = class_basename($this->modelClass($resource));

        if ($formClass = $this->finder->formClass($resource, $modelClass)) {
            return $formClass;
        }

        return '';
    }
937657
public function getResource($resource)
    {
        if ($this->resourceExists($resource)) return $this->_resources[$resource];

        throw new ContainerResourceNotFoundException('Resource ' . $resource . ' does not exist in the Container');
    }
306289
public function load($resource, $type = null)
    {
        $collection = $this->loader->load($resource, $type);

        foreach ($collection->all() as $route) {
            if ('https' === $route->getRequirement('_scheme')) {
                $requirements = $route->getRequirements();
                unset($requirements['_scheme']);
                $route->setRequirements($requirements);
            }
        }

        return $collection;
    }
196204
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()
        );
    }
1214074
public function getId($resource): ?string
    {
        assert(get_class($resource) === static::MODEL);
        assert($this->classImplements(static::MODEL, ModelInterface::class) === true);

        /** @var ModelInterface $modelClass */
        $modelClass = static::MODEL;

        $pkName = $modelClass::getPrimaryKeyName();

        return $resource->{$pkName};
    }
595563
public function loadResource($resource)
    {
        // If possible use our custom xliff loader, so we get metadata
        if (in_array($resource['format'], array('xliff', 'xlf'))) {
            return $this->container->get('liip.translation.xliff.loader')->load($resource['path'], $resource['locale'], $resource['domain']);
        }

        // Search for an other services
        foreach ($this->loaderIds as $serviceId => $formats) {
            if (!is_array($formats)) {
                $formats = array($formats);
            }
            foreach ($formats as $format) {
                if ($resource['format'] === $format) {
                    return $this->container->get($serviceId)->load($resource['path'], $resource['locale'], $resource['domain']);
                }
            }
        }

        throw new \RuntimeException("Not service found to load {$resource['path']}");
    }
1099945
public function form($model=null, $resource=null)
    {

        $resource = $this->passedOrCurrent($resource);

        if (!$formClass = $this->formClass($resource)) {
            return '';
        }

        return $this->makeForm($resource, $formClass, $model);

    }
311052
public function load($resource)
    {
        if ($issue = $this->getIssue($resource)) {
            return $this->createFeature($issue);
        }

        return $this->createFeatures();
    }
50702
public function load($resource, $type = null)
    {
        return $this->routeCollectionMapper->mapCollection($this->import($resource));
    }
1278996
protected function collectResource($resource)
    {
        if ($resource instanceof MissingValue) {
            return $resource;
        }

        $collects = $this->collects();

        $this->collection = $collects && ! $resource->first() instanceof $collects
            ? $resource->mapInto($collects)
            : $resource->toBase();

        return $resource instanceof AbstractPaginator
                    ? $resource->setCollection($this->collection)
                    : $this->collection;
    }
1367693
public function queryCacheState(string $resource = null): ?array
    {
        if ($resource === null) {
            return $this->cacheState;
        }

        if (isset($this->newCacheState[$resource])) {
            return $this->newCacheState[$resource];
        }

        if (isset($this->cacheState[$resource])) {
            return $this->cacheState[$resource];
        }

        return null;
    }
55905
private function getResourceData($resource)
    {
        $data = false;
        if(!is_null($resource) && $resource->exists()) {
            $resourceTypes = array_keys($resource->getTypes());
            $data = [
                'uri'        => $resource->getUri(),
                'classUri'   => $resourceTypes[0],
                'label'      => $resource->getLabel(),
                'type'       => 'instance'
            ];
        }
        return $data;
    }
633345
public function getForResource($resource)
    {
        $resourceName = $this->resourceName($resource);

        if (isset($this->resourceFactories[$resourceName])) {
            return $this->resourceFactories[$resourceName];
        }

        throw new HandlerNotFoundException("No handler found for resource '$resourceName'");

    }
331614
public function makeUrl($resource)
    {
        $host     = trim(str_replace(['http://', 'https://'], null, $this->host), '/');
        $resource = trim($resource, '/');
        //Create URI
        $uri = $host . ':' . $this->port . '/' . $resource;

        return $uri;
    }
181613
public function resolveResource($resource)
    {
        // String of the form vendor/package:resource. Excludes "http://bla" as that's an absolute URL
        if (!preg_match('#^ *(?<module>[^/: ]+/[^/: ]+) *: *(?<resource>[^ ]*)$#', $resource, $matches)) {
            return $resource;
        }
        $module = $matches['module'];
        $resource = $matches['resource'];
        $moduleObj = ModuleLoader::getModule($module);
        if (!$moduleObj) {
            throw new InvalidArgumentException("Can't find module '$module', the composer.json file may be missing from the modules installation directory");
        }
        $resourceObj = $moduleObj->getResource($resource);

        return $resourceObj;
    }