Add resource to track for changes.

@param ResourceInterface $resource

@return $this The current instance
517422
public function addResource(ResourceInterface $resource)
    {
        $resourceStr = (string) $resource;

        $this->container->register(RouteAutowiringExtension::EXTENSION_ALIAS.'.resources.'.sha1($resourceStr), get_class($resource))
            ->setPublic(false)
            ->setArguments([$resourceStr])
            ->addTag(RouteResourcePass::TAG_NAME);

        return $this;
    }
414555
public function addResource(string ...$resource)
    {
        foreach ($resource as $_resource)
        {
            $this->resourceRegistry->save($_resource);
        }
    }
15459
private function createRepositoryDefinition(ResourceInterface $resource)
    {
        $definition = new Definition($resource->getRepository(), [$resource->getModel()]);
        $definition->setFactory([new Reference('lug.manager.'.$resource->getName()), 'getRepository']);
        $definition->addTag('lug.repository', ['resource' => $resource->getName()]);

        return $definition;
    }
602606
public function addOptionalResource($resource, $prefix = null)
    {
        $this->resources[] = [$resource, $prefix, false];

        return $this;
    }
993260
private function createControllerDefinition(ResourceInterface $resource)
    {
        $definition = new Definition($resource->getController(), [
            new Reference('lug.resource.'.$resource->getName()),
        ]);

        $definition->addMethodCall('setContainer', [new Reference('service_container')]);
        $definition->addTag('lug.controller', ['resource' => $resource->getName()]);

        return $definition;
    }
1319377
function addResource($name, $resource)
    {
        $name = (string) $name;

        if (array_key_exists($name, $this->_t_loader_map_resource_MapRes))
            throw new \Exception(sprintf(
                'Resource Map (%s) already exists in map.'
                , $name
            ));

        $this->_t_loader_map_resource_MapRes[$name] = $resource;
        return $this;
    }
410795
public function setResource(ResourceInterface $resource = null)
    {
        $this->resource = $resource;

        // Clear urls
        $this->urls = null;

        return $this;
    }
478148
public static function fromResources(ResourceInterface ...$resources) {
		$collectionDocument = new self();
		
		foreach ($resources as $resource) {
			$collectionDocument->addResource($resource);
		}
		
		return $collectionDocument;
	}
1047045
public function addSecondaryResource(ResourceNode $resource)
    {
        if (!$this->secondaryResources->contains($resource)) {
            $this->secondaryResources->add($resource);
        }

        return $this;
    }
458338
public function patchAction( $resource )
	{
		$response = $this->createAdmin( $resource )->patch( $this->getPsrRequest(), new Response() );
		return $this->setPsrResponse( $response );
	}
566835
public function setBackup($resource, $name = null)
    {
        $name = $name ?? 'default';

        $this->backups[$name] = $resource;

        return $this;
    }
828741
public function onLoaded(ResourceInterface $resource)
    {
        if (!$this->isDebugging() || $this->current === $resource) {
            return;
        }

        $this->ensureCollector($this->current);
        $this->meta[$this->current]->addResource($resource);
    }
13827
public function remove($resource)
    {
        $keysToRemove = array_keys($this->collection, $resource, true);
        $this->collection = array_values(array_diff_key($this->collection, array_flip($keysToRemove)));
        return $this;
    }
3876
public function addResourceProvider(ResourceProvider $provider)
    {
        $this->loaded && $this->loaded->__invoke();

        $this->resourceProviders[] = $provider;

        return $this;
    }
1121120
public function addResource(AbstractResourceFile $resource) {
        if (!parent::offsetExists($resource->getMemberId())) {
            parent::offsetSet($resource->getMemberId(), $resource);
        }
    }
756753
public static function fromResource(ResourceInterface $resource, $path)
	{
		if ($resource instanceof FileResourceInterface) {
			return $resource;
		}
		file_put_contents($path, $resource->getStream());
		$attr = [
			'mimetype' => $resource->getMimetype(),
			'lastmodified' => $resource->getLastModified(),
			'filename' => $resource->getFilename()
		];
		return new FileResource($path, $attr);
	}
1192148
public function update($name, $id, HttpResourceInterface $resource)
    {
        $definition = $this->capabilities->get($name);
        $this->client->update(
            $definition->getUrl() . (string) $id,
            $resource
        );

        return $this;
    }