Append the source

@param  Resource | string $resource
@return Resource
968198
public function appendResource($resource) {
		$resource = $this->handleResource($resource);
		
		$this->resources[] = $resource;
		return $resource;
	}
1024034
public static function createFromResource($resource): Stream
    {
        if (!\is_resource($resource))
        {
            throw new \InvalidArgumentException('Stream must be a resource');
        }

        $obj           = new self();
        $obj->stream   = $resource;
        $meta          = stream_get_meta_data($obj->stream);
        $obj->seekable = $meta['seekable'];
        $obj->readable = isset(self::$readWriteHash['read'][$meta['mode']]);
        $obj->writable = isset(self::$readWriteHash['write'][$meta['mode']]);
        $obj->uri      = $obj->getMetadata('uri');

        return $obj;
    }
1131833
public function attach($resource){
        if(!is_resource($resource) || "stream" !== get_resource_type($resource)){
            throw new \InvalidArgumentException(
                "Argument must be of the type stream resource, " . gettype($resource) . " given."
            );
        }

        $this->resource = $resource;
    }
1118100
public function prepend($source)
    {
        $importNode = $this->ownerDocument->importNode($this->ownerDocument->importSourceNode($source), true);

        return $this->appendChild($importNode);
    }
863252
public function getResourceUrl($resource)
    {
        if (!$this->directory) {
            $this->directory = new ResourcesDirectory(
                $this->getHttpClient()->unsignedRequest('GET', $this->directoryUrl, null, true)
            );
        }

        return $this->directory->getResourceUrl($resource);
    }
443660
public function addResource(string $name, $resource): self
    {
        if ($resource instanceof StreamInterface) {
            $in = $resource;
        } elseif (\is_resource($resource)) {
            $in = new ResourceInputStream($resource);
        } else {
            $resource = (string) $resource;
            
            if (\preg_match("'^/|(?:[^:\\\\/]+://)|(?:[a-z]:[\\\\/])'i", $resource)) {
                $in = ResourceInputStream::fromUrl($resource);
            } else {
                $in = new StringStream($resource);
            }
        }
        
        $this->resources[\trim(\str_replace('\\', '/', $name), '/')] = $in;
        
        return $this;
    }
326454
def add(self, resource):
        
        if isinstance(resource, collections.Iterable):
            for r in resource:
                self.resources.append(r)
        else:
            self.resources.append(resource)
687921
public function appendStream($source, $offset = 0)
    {
        $chunkFile = $this->chunkFile();
        $this->files->appendStream($chunkFile, $source, (int) $offset);

        return $this;
    }
1120057
protected function addResource($resource)
    {
        $resource = trim($resource);
        if (strlen($resource)) {
            $this->resources[] = $resource;
        }
    }
137222
public function addResource(ResourceInterface $resource)
    {
        $key = (string) $resource;

        if (!isset($this->resources[$key])) {
            $this->resources[$key] = $resource;
        }
    }
631959
protected function createAdmin( $resource )
	{
		$context = $this->getContextBackend( 'admin/jsonadm/templates' );
		return \Aimeos\Admin\JsonAdm::create( $context, Base::getAimeos(), $resource );
	}
429157
protected function handleResource($resource) {
		if ($resource instanceof Resource) {
			return $resource;
		}
		
		// Is not a local resource
		if (preg_match('~^[a-z]+:~', $resource)) {
			$slashPos = strrpos($resource, '/');
			
			$base = substr($resource, 0, $slashPos);
			$name = substr($resource, $slashPos + 1);
			
			$resource = new Resource($name, $base, $base, $this->metadataManager);
		} else {
			$resource = new Resource($resource, $this->basePath, $this->baseUrl, $this->metadataManager);
		}
		
		if ($this->hashAppend) {
			$resource->setHashAppend(true);
		}
		
		return $resource;
	}
1178469
public function shallow(self $resource)
    {
        $newResource = new self;
        $resource->forget();
        $routes = $resource->all();

        foreach ($routes as $route) {
            if (strpos("index make create", $route->getAction()[1]) !== false) {
                $newResource->set($route);
            }
        }

        return $this->nest($newResource);
    }
385139
public function addResource(ResourceInterface $resource, $name = null) {
		if ($name === null) {
			$this->resources[] = $resource;
			
			return $this;
		}
		
		$this->resources[$name] = $resource;
		
		return $this;
	}
235957
public static function fromResource(Resource $resource)
    {
        if (isset($resource->query['with_billets'])) {
            return static::withBillets($resource);
        }
        return parent::fromResource($resource);
    }
1243372
protected function _addResources($resources)
    {
        foreach ($resources as $permission => $controllers) {
            foreach ($controllers as $controller => $actions) {
                if ($controller == 'all') {
                    $controller = null;
                } else {
                    if (!$this->hasResource($controller)) {
                        $this->addResource(new Resource($controller));
                    }
                }

                foreach ($actions as $action => $role) {
                    if ($action == 'all') {
                        $action = null;
                    }

                    if ($permission == 'allow') {
                        $this->allow($role, $controller, $action);
                    } elseif ($permission == 'deny') {
                        $this->deny($role, $controller, $action);
                    } else {
                        throw new \Exception('No valid permission defined: ' . $permission);
                    }
                }
            }
        }

        return $this;
    }
392755
protected function makeRequest($resource)
    {
        $url = "{$this->api_url}/{$resource}";

        $response = $this->guzzle->get($url, $this->getHeaders())->getBody();

        return json_decode($response, true);
    }