{@inheritdoc}

@see https://www.ietf.org/rfc/rfc4954.txt
349208
public function authenticate(EsmtpTransport $client): void
    {
        $client->executeCommand("AUTH LOGIN\r\n", [334]);
        $client->executeCommand(sprintf("%s\r\n", base64_encode($client->getUsername())), [334]);
        $client->executeCommand(sprintf("%s\r\n", base64_encode($client->getPassword())), [235]);
    }
1219796
public static function setHttpHeaders(){
		if(!is_array(self::$httpHeaders)){
			self::$httpHeaders=array();
			$httpHeaders=$_SERVER;
			foreach($httpHeaders as $key=>$value)
				if(substr($key,0,5)=='HTTP_')
                			self::$httpHeaders[$key]=$value;
			}
		}
1312730
private static function resolveAuthority(){
        $host   = filter_input(INPUT_SERVER, "HTTP_HOST");

        if(is_string($host)){
            return $host;
        }

        $port   = filter_input(INPUT_SERVER, "REQUEST_PORT", FILTER_VALIDATE_INT);
        $name   = filter_input(INPUT_SERVER, "SERVER_NAME");

        if(false === $port){
            throw new \RuntimeException();
        }

        if(is_string($name)){
            return $name . (null === $port ? "" : (":" . $port));
        }

        $addrv4 = filter_input(INPUT_SERVER, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);
        $addrv6 = filter_input(INPUT_SERVER, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6);

        if(is_string($addrv4)){
            return $addrv4 . (null === $port ? "" : (":" . $port));
        }

        if(is_string($addrv6)){
            return "[" . $addrv6. "]" . (null === $port ? "" : (":" . $port));
        }

        throw new \RuntimeException;
    }
796294
public function init($streamWrapper = self::STREAM_WRAPPER_TEMP, $maxMemory = 5242880)
    {

        // weather we've already set a filename open the input stream
        if ($tmpFilename = $this->getTmpFilename()) {
            if (!$this->inputStream = fopen($tmpFilename, 'r+')) {
                throw new \Exception(sprintf('Can\'t open input temporary filename %s', $tmpFilename));
            }
        } else {
            if (!$this->inputStream = fopen($streamWrapper . '/maxmemory:' . $maxMemory, 'r+')) {
                throw new \Exception(sprintf('Can\'t open stream wrapper %s', $streamWrapper));
            }
        }
    }
1095660
private function parseFilterLink(): self
    {
        if (array_key_exists(static::PARAM_FILTER, $this->getParameters()) === false) {
            $this->setFiltersWithAnd()->setFilterParameters([]);

            return $this;
        }

        $filterSection = $this->getParameters()[static::PARAM_FILTER];
        if (is_array($filterSection) === false || empty($filterSection) === true) {
            throw new InvalidQueryParametersException($this->createParameterError(
                static::PARAM_FILTER,
                $this->getInvalidParamMessage()
            ));
        }

        $isWithAnd = true;
        reset($filterSection);

        // check if top level element is `AND` or `OR`
        $firstKey   = key($filterSection);
        $firstLcKey = strtolower(trim($firstKey));
        if (($hasOr = ($firstLcKey === 'or')) || $firstLcKey === 'and') {
            if (count($filterSection) > 1 ||
                empty($filterSection = $filterSection[$firstKey]) === true ||
                is_array($filterSection) === false
            ) {
                throw new InvalidQueryParametersException($this->createParameterError(
                    static::PARAM_FILTER,
                    $this->getInvalidParamMessage()
                ));
            } else {
                $this->setFilterParameters($filterSection);
                if ($hasOr === true) {
                    $isWithAnd = false;
                }
            }
        } else {
            $this->setFilterParameters($filterSection);
        }

        $isWithAnd === true ? $this->setFiltersWithAnd() : $this->setFiltersWithOr();

        return $this;
    }
1013981
private function setUnsupportedMethodsIfExists()
    {
        if (!function_exists('mb_strpos')) {
            throw new \Exception('You must have php-mbstring extension installed in the server.');
        }

        /*
         * If the content is not passed from FORM then we will simply return corresponding
         * GLOBAL variable raw data
         */
        if (
            \mb_strpos($this->header->get('CONTENT_TYPE'), 'application/x-www-form-urlencoded') === 0 &&
            in_array($this->getMethod(), [RequestMethods::PUT, RequestMethods::PATCH, RequestMethods::DELETE])
        ) {
            parse_str($this->getRawBody(), $array);

            switch ($this->getMethod()) {
                case RequestMethods::PUT:
                    $this->put->exchangeArray($array);
                    break;
                case RequestMethods::PATCH:
                    $this->patch->exchangeArray($array);
                    break;
                case RequestMethods::DELETE:
                    $this->delete->exchangeArray($array);
                    break;
            }
        }
    }
1329446
@Override
    public int doEndTag() throws JspException {
        String result;                // the eventual result

        // add (already encoded) parameters
        String baseUrl = UrlSupport.resolveUrl(url, context, pageContext);
        result = params.aggregateParams(baseUrl);

        // if the URL is relative, rewrite it with 'redirect' encoding rules
        HttpServletResponse response =
                ((HttpServletResponse) pageContext.getResponse());
        if (!UrlUtil.isAbsoluteUrl(result)) {
            result = response.encodeRedirectURL(result);
        }

        // redirect!
        try {
            response.sendRedirect(result);
        } catch (java.io.IOException ex) {
            throw new JspTagException(ex.toString(), ex);
        }

        return SKIP_PAGE;
    }
836929
public function getTtl(): ?int
    {
        $maxAge = $this->getMaxAge();

        return null !== $maxAge ? $maxAge - $this->getAge() : null;
    }
1364972
public function date_rfc2822($date)
	{
		static $pcre;
		if (!$pcre)
		{
			$wsp = '[\x09\x20]';
			$fws = '(?:' . $wsp . '+|' . $wsp . '*(?:\x0D\x0A' . $wsp . '+)+)';
			$optional_fws = $fws . '?';
			$day_name = $this->day_pcre;
			$month = $this->month_pcre;
			$day = '([0-9]{1,2})';
			$hour = $minute = $second = '([0-9]{2})';
			$year = '([0-9]{2,4})';
			$num_zone = '([+\-])([0-9]{2})([0-9]{2})';
			$character_zone = '([A-Z]{1,5})';
			$zone = '(?:' . $num_zone . '|' . $character_zone . ')';
			$pcre = '/(?:' . $optional_fws . $day_name . $optional_fws . ',)?' . $optional_fws . $day . $fws . $month . $fws . $year . $fws . $hour . $optional_fws . ':' . $optional_fws . $minute . '(?:' . $optional_fws . ':' . $optional_fws . $second . ')?' . $fws . $zone . '/i';
		}
		if (preg_match($pcre, $this->remove_rfc2822_comments($date), $match))
		{
			/*
			Capturing subpatterns:
			1: Day name
			2: Day
			3: Month
			4: Year
			5: Hour
			6: Minute
			7: Second
			8: Timezone ±
			9: Timezone hours
			10: Timezone minutes
			11: Alphabetic timezone
			*/

			// Find the month number
			$month = $this->month[strtolower($match[3])];

			// Numeric timezone
			if ($match[8] !== '')
			{
				$timezone = $match[9] * 3600;
				$timezone += $match[10] * 60;
				if ($match[8] === '-')
				{
					$timezone = 0 - $timezone;
				}
			}
			// Character timezone
			elseif (isset($this->timezone[strtoupper($match[11])]))
			{
				$timezone = $this->timezone[strtoupper($match[11])];
			}
			// Assume everything else to be -0000
			else
			{
				$timezone = 0;
			}

			// Deal with 2/3 digit years
			if ($match[4] < 50)
			{
				$match[4] += 2000;
			}
			elseif ($match[4] < 1000)
			{
				$match[4] += 1900;
			}

			// Second is optional, if it is empty set it to zero
			if ($match[7] !== '')
			{
				$second = $match[7];
			}
			else
			{
				$second = 0;
			}

			return gmmktime($match[5], $match[6], $second, $month, $match[2], $match[4]) - $timezone;
		}
		else
		{
			return false;
		}
	}
976473
public function Rfc2822()
    {
        $formatter = $this->getInternalFormatter();
        $formatter->setPattern('y-MM-dd HH:mm:ss');
        return $formatter->format($this->getTimestamp());
    }
1346888
final public static function setSMTP (string $host, string $username, string $password, string $SMTPSecure, int $port) : \stdClass
	{
		return (object) $SMTPConfig = [
			'host' 			=> $host,
			'username' 		=> $username,
			'password' 		=> $password,
			'SMTPSecure' 	=> $SMTPSecure,
			'port' 			=> $port
		];
	}
192063
public function formatIdPCertMulti()
    {
        if (isset($this->_idp['x509certMulti'])) {
            if (isset($this->_idp['x509certMulti']['signing'])) {
                foreach ($this->_idp['x509certMulti']['signing'] as $i => $cert) {
                    $this->_idp['x509certMulti']['signing'][$i] = OneLogin_Saml2_Utils::formatCert($cert);
                }
            }
            if (isset($this->_idp['x509certMulti']['encryption'])) {
                foreach ($this->_idp['x509certMulti']['encryption'] as $i => $cert) {
                    $this->_idp['x509certMulti']['encryption'][$i] = OneLogin_Saml2_Utils::formatCert($cert);
                }
            }
        }
    }
779791
function checkMapForCurrentServerParams($filename, $multicall = false)
    {
        if (!is_string($filename)) {
            throw new InvalidArgumentException('filename = ' . print_r($filename, true));
        }
        $filename = $this->secureUtf8($filename);

        return $this->execute(ucfirst(__FUNCTION__), array($filename), $multicall);
    }
929792
public function finish()
    {
        $charset = "us-ascii"; // RFC 2822 default
        if ( isset( $this->headers['Content-Type'] ) )
        {
            preg_match( '/\s*charset\s?=\s?"?([^;"\s]*);?/',
                            $this->headers['Content-Type'],
                            $parameters );
            if ( count( $parameters ) > 0 )
            {
                $charset = strtolower( trim( $parameters[1], '"' ) );
            }
        }

        $encoding = strtolower( $this->headers['Content-Transfer-Encoding'] );
        if ( $encoding == ezcMail::QUOTED_PRINTABLE )
        {
            $this->text = quoted_printable_decode( $this->text );
        }
        else if ( $encoding == ezcMail::BASE64 )
        {
            $this->text = base64_decode( $this->text );
        }

        $this->text = ezcMailCharsetConverter::convertToUTF8( $this->text, $charset );

        $part = new ezcMailText( $this->text, 'utf-8', ezcMail::EIGHT_BIT, $charset );
        $part->subType = $this->subType;
        $part->setHeaders( $this->headers->getCaseSensitiveArray() );
        ezcMailPartParser::parsePartHeaders( $this->headers, $part );
        $part->size = strlen( $this->text );
        return $part;
    }
1078021
public function fromStream(FilesystemStreamInterface $stream)
    {
        if (!$stream->isReadable()) {
            throw new \RuntimeException('Stream not readable');
        }

        $mimetype = null;

        foreach (array_reverse($this->__resolvers) as $name => $resolver)
        {
            //Lazy create the resolver
            if(!($resolver instanceof FilesystemMimetypeInterface))
            {
                $resolver = $this->getObject($resolver);

                if (!$resolver instanceof FilesystemMimetypeInterface) {
                    throw new \UnexpectedValueException('Resolver does not implement FilesystemMimetypeInterface');
                }

                $this->__resolvers[$name] = $resolver;
            }

            /* @var $resolver FilesystemMimetypeInterface */
            if (null !== $mimetype = $resolver->fromStream($stream)) {
                break;
            }
        }

        return $mimetype;
    }
815895
public function serializeToString() {
    $uninitialized = $this->checkInitialized();
    if ($uninitialized !== null) {
      throw new ProtocolBufferEncodeError(
        "Not initialized: " . $uninitialized);
    }
    return $this->serializePartialToString();
  }
119908
private function lazyParseStructure(): void
    {
        if (true === $this->structureParsed) {
            return;
        }
        $this->structureParsed = true;

        $this->lazyLoadStructure();

        $this->type = self::$typesMap[$this->structure->type] ?? self::TYPE_UNKNOWN;

        // In our context, \ENCOTHER is as useful as an uknown encoding
        $this->encoding = self::$encodingsMap[$this->structure->encoding] ?? self::ENCODING_UNKNOWN;
        $this->subtype  = $this->structure->subtype;

        if (isset($this->structure->bytes)) {
            $this->bytes = $this->structure->bytes;
        }
        if ($this->structure->ifdisposition) {
            $this->disposition = $this->structure->disposition;
        }
        if ($this->structure->ifdescription) {
            $this->description = $this->structure->description;
        }

        $this->parameters = new Parameters();
        if ($this->structure->ifparameters) {
            $this->parameters->add($this->structure->parameters);
        }

        if ($this->structure->ifdparameters) {
            $this->parameters->add($this->structure->dparameters);
        }

        // When the message is not multipart and the body is the attachment content
        // Prevents infinite recursion
        if (self::isAttachment($this->structure) && !$this instanceof Attachment) {
            $this->parts[] = new Attachment($this->resource, $this->getNumber(), '1', $this->structure);
        }

        if (isset($this->structure->parts)) {
            $parts = $this->structure->parts;
            // https://secure.php.net/manual/en/function.imap-fetchbody.php#89002
            if ($this instanceof Attachment && $this->isEmbeddedMessage() && 1 === \count($parts) && \TYPEMULTIPART === $parts[0]->type) {
                $parts = $parts[0]->parts;
            }
            foreach ($parts as $key => $partStructure) {
                $partNumber = (!$this instanceof Message) ? $this->partNumber . '.' : '';
                $partNumber .= (string) ($key + 1);

                $newPartClass = self::isAttachment($partStructure)
                    ? Attachment::class
                    : SimplePart::class
                ;

                $this->parts[] = new $newPartClass($this->resource, $this->getNumber(), $partNumber, $partStructure);
            }
        }
    }