add an enclosure to the item

@param   string  $url     location of enclosure
@param   int     $length  length of enclosure in bytes
@param   string  $type    MIME type of enclosure
@return  \stubbles\xml\rss\RssFeedItem
326009
public function deliveringEnclosure(string $url, int $length, string $type): self
    {
        $this->enclosures[] = [
                'url'    => $url,
                'length' => $length,
                'type'   => $type
        ];
        return $this;
    }
1309530
public static String postFrom(
                    final URL to_url,
                    final Reader from_reader,
                    final MediaType media_type
                    )
    {
        ReaderRequestCallback  callback =
                        new ReaderRequestCallback( from_reader, media_type );
        String  location = _execute( to_url, HttpMethod.POST, callback,
                        new LocationHeaderResponseExtractor() );

        return location;
    }
986932
private function createUrl($request, string $type)
  {
    $data = ($type == 'expire') ? $this->canExpire : $this->except;

    foreach($data as $i => $url) {
      if (str_contains($url, '{*}')) {
        $path = explode('/', (substr($request->path(), 0, 1) == '/' ? substr($request->path(), 1) : $request->path()));
        $url = explode('/', (substr($url, 0, 1) == '/' ? substr($url, 1) : $url));

        if (count($path) == count($url)) {
          $current = [];

          foreach($url as $k => $t) {
            if ($t == $path[$k]) {
              $current[] = $t;
            } elseif ($t == '{*}') {
              $current[] = $path[$k];
            }
          }

          $data[$i] = implode('/', $current);
        }
      }
    }

    if ($type == 'expire') {
      $this->canExpire = $data;
    } else {
      $this->except = $data;
    }
  }
738942
public function addOneLink($rel, $href, $type = '', $attr = array(), $cond = '')
	{
		$this->addLink(array(array($rel, $href, $type, $attr, $cond)));
	}
1352153
public function add($url, $title = '', $parameters = [])
    {
        // If only {$url} specified, use it as title for current page
        if (func_num_args() === 1) {
            return $this->addCurrent($url);
        }

        $url = $this->parseUrl($url, $parameters);

        $this->crumbs[] = new CrumbsItem($url, $title, $this->url, $this->config);

        return $this;
    }
533252
public function installExtensionFromUrl($url, $type = 'Extension')
	{
		$this->amOnPage('/administrator/index.php?option=com_installer');
		$this->waitForText('Extensions: Install', '30', array('css' => 'H1'));
		$this->click(array('link' => 'Install from URL'));
		$this->debug('I enter the url');
		$this->fillField(array('id' => 'install_url'), $url);
		$this->click(array('id' => 'installbutton_url'));
		$this->waitForText('was successful', '30', array('id' => 'system-message-container'));

		if ($type == 'Extension')
		{
			$this->debug('Extension successfully installed from ' . $url);
		}

		if ($type == 'Plugin')
		{
			$this->debug('Installing plugin was successful.' . $url);
		}

		if ($type == 'Package')
		{
			$this->debug('Installation of the package was successful.' . $url);
		}
	}
582734
public static String createPUTHeader(String path,
					 String host,
					 String user_agent,
					 String type,
					 long length,
					 boolean append) {

	StringBuffer head = new StringBuffer();

	if (append) {
	    head.append("POST ");
	} else {
	    head.append("PUT ");
	}

	head.append(path + " " + HTTP_VERSION + CRLF);

	head.append(HOST + host + CRLF);
	head.append(CONNECTION_CLOSE);
	head.append(USER_AGENT + user_agent + CRLF);
	head.append(CONTENT_TYPE + type + CRLF);

	if (length == -1) {
	    head.append(CHUNKING);
	} else {
	    head.append(CONTENT_LENGTH + length + CRLF);
	}

	head.append(CRLF);

	return head.toString();
    }
183686
public function installRepository(string $name, string $type, string $url)
    {
        if (array_key_exists('repositories', $this->definition)
            && array_key_exists($name, $this->definition['repositories'])
        ) {
            return;
        }

        $application = new Application();
        $command     = new ConfigCommand();

        $definition = clone $application->getDefinition();
        $definition->addArguments($command->getDefinition()->getArguments());
        $definition->addOptions($command->getDefinition()->getOptions());

        $input = new ArrayInput(
            [
                'command' => 'config',
                'setting-key' => 'repositories.' . $name,
                'setting-value' => [
                    $type,
                    $url
                ],
                '--working-dir' => $this->workingDir
            ],
            $definition
        );

        $application->setAutoExit(false);
        $application->run($input, $this->output);
    }
23292
private function doLTI11Service($type, $url, $xml)
    {

        $ok = false;
        $this->extRequest = null;
        $this->extRequestHeaders = '';
        $this->extResponse = null;
        $this->extResponseHeaders = '';
        if (!empty($url)) {
            $id = uniqid();
            $xmlRequest = <<< EOD
<?xml version = "1.0" encoding = "UTF-8"?>
<imsx_POXEnvelopeRequest xmlns = "http://www.imsglobal.org/services/ltiv1p1/xsd/imsoms_v1p0">
  <imsx_POXHeader>
    <imsx_POXRequestHeaderInfo>
      <imsx_version>V1.0</imsx_version>
      <imsx_messageIdentifier>{$id}</imsx_messageIdentifier>
    </imsx_POXRequestHeaderInfo>
  </imsx_POXHeader>
  <imsx_POXBody>
    <{$type}Request>
{$xml}
    </{$type}Request>
  </imsx_POXBody>
</imsx_POXEnvelopeRequest>
EOD;
// Calculate body hash
            $hash = base64_encode(sha1($xmlRequest, true));
            $params = array('oauth_body_hash' => $hash);

// Add OAuth signature
            $hmacMethod = new OAuth\OAuthSignatureMethod_HMAC_SHA1();
            $consumer = new OAuth\OAuthConsumer($this->getConsumer()->getKey(), $this->getConsumer()->secret, null);
            $req = OAuth\OAuthRequest::from_consumer_and_token($consumer, null, 'POST', $url, $params);
            $req->sign_request($hmacMethod, $consumer, null);
            $params = $req->get_parameters();
            $header = $req->to_header();
            $header .= "\nContent-Type: application/xml";
// Connect to tool consumer
            $http = new HTTPMessage($url, 'POST', $xmlRequest, $header);
// Parse XML response
            if ($http->send()) {
                $this->extResponse = $http->response;
                $this->extResponseHeaders = $http->responseHeaders;
                try {
                    $this->extDoc = new DOMDocument();
                    $this->extDoc->loadXML($http->response);
                    $this->extNodes = $this->domnodeToArray($this->extDoc->documentElement);
                    if (isset($this->extNodes['imsx_POXHeader']['imsx_POXResponseHeaderInfo']['imsx_statusInfo']['imsx_codeMajor']) &&
                        ($this->extNodes['imsx_POXHeader']['imsx_POXResponseHeaderInfo']['imsx_statusInfo']['imsx_codeMajor'] === 'success')) {
                        $ok = true;
                    }
                } catch (\Exception $e) {
                }
            }
            $this->extRequest = $http->request;
            $this->extRequestHeaders = $http->requestHeaders;
        }

        return $ok;

    }
568752
public function addWebButton($text, $url)
    {
        $this->add(new Button(Button::TYPE_WEB, $text, $url));

        return $this;
    }
715373
public function addContent($type, $value = null)
    {
        if ($type instanceof Content) {
            $content = $type;
        } else {
            $content = new Content($type, $value);
        }
        $this->contents[] = $content;
    }
142687
public function addImageFromUrl($url) {
        if (is_string($url)) {
            // URL specified as a string. Create a URL instance
            $url = GuzzleUrl::factory($url);
        }

        if (!($url instanceof GuzzleUrl)) {
            // Invalid argument
            throw new InvalidArgumentException(
                'Parameter must be a string or an instance of Guzzle\Http\Url'
            );
        }

        if (!$url->getScheme()) {
            throw new InvalidArgumentException('URL is missing scheme: ' . (string) $url);
        }

        // Fetch the image we want to add
        $image = (string) $this->get($url)->send()->getBody();

        return $this->addImageFromString($image);
    }
566958
public static function create($href = '#', $rel = null, $type = null, $media = null)
    {
        return new static($href, $rel, $type, $media);
    }
510721
public Message addContent(String name, String type, String value) {
        content.put(name, new Content(type, value));
        return this;
    }
1080861
public function addUrl($url)
    {
        $page = new Page($url);
        $this->addContent($page->getHTML(), $url);

        return $this;
    }
693883
protected static function replaceUrl($value, $url, $urlConv, $type) {
    if ($type == 'embedded') {
      $value = str_replace('"'.$url.'"', '"'.$urlConv.'"', $value);
    }
    else {
      $value = str_replace($url, $urlConv, $value);
    }
    return $value;
  }
1252486
public function open($uri, $mode='r+', $lock=false)
    {

        if (is_resource($uri)) {
            return new ResourceStream($uri, $lock);
        }

        if (!Type::isStringLike($uri) && !$uri instanceof UrlContract) {
            throw new TypeException('$uri has to be string or ' . Type::of($uri));
        }

        $uri = $uri instanceof UrlContract ? $uri : new Url($uri);

        if ($uri->scheme == 'http' || $uri->scheme == 'https' && class_exists(HttpFileStream::class)) {
            return new HttpFileStream($uri, $mode, $lock);
        }

        return new FileStream($uri, $mode, $lock);
    }