Initialize headers

@param mixed $options
@param string $hostname hostname
@return array
768496
private function generateHeaders($options, $hostname)
    {
        $headers = array(
            self::OSS_CONTENT_MD5 => '',
            self::OSS_CONTENT_TYPE => isset($options[self::OSS_CONTENT_TYPE]) ? $options[self::OSS_CONTENT_TYPE] : self::DEFAULT_CONTENT_TYPE,
            self::OSS_DATE => isset($options[self::OSS_DATE]) ? $options[self::OSS_DATE] : gmdate('D, d M Y H:i:s \G\M\T'),
            self::OSS_HOST => $hostname,
        );
        if (isset($options[self::OSS_CONTENT_MD5])) {
            $headers[self::OSS_CONTENT_MD5] = $options[self::OSS_CONTENT_MD5];
        }

        //Add stsSecurityToken
        if ((!is_null($this->securityToken)) && (!$this->enableStsInUrl)) {
            $headers[self::OSS_SECURITY_TOKEN] = $this->securityToken;
        }
        //Merge HTTP headers
        if (isset($options[self::OSS_HEADERS])) {
            $headers = array_merge($headers, $options[self::OSS_HEADERS]);
        }
        return $headers;
    }
297015
public function header($options = [])
    {
        $_options = [
            'before' => '<h3>',
            'after' => '</h3>'
        ];

        $options = array_merge($_options, $options);

        return $options['before'] . h($this->_type['alias']) . $options['after'];
    }
557432
public static function initConfig(array $options) {
		self::$config = $options;

		$names = array(
			'T_NAMESPACE',
			'T_NS_C',
			'T_NS_SEPARATOR',
		);

		foreach ($names as $name) {
			if (!defined($name)) {
				// just define it with value unused by tokenizer to avoid errors on old PHP versions
				define($name, 10000);
			}
		}
	}
383324
public function setOptions($options)
    {
        // Adding hosts.
        if (!empty($options['hosts'])) {
            foreach ($options['hosts'] as $host => $port) {
                $this->addserver($host, $port, false);
            }
        } else {
            $this->addserver('127.0.0.1', '11211', false);
        }
    }
588942
protected function dsn_options($dsn)
    {
        $params = array();

        if ($dsn['hostspec']) {
            $host = $dsn['hostspec'];
            if ($dsn['port']) {
                $host .= ':' . $dsn['port'];
            }

            $params['database'] = $host . '/' . $dsn['database'];
        }

        $params['charset'] = 'UTF8';

        return $params;
    }
940174
public static function tcp(string $host, array $options = []) : Socket
    {
        return self::create($host, \array_merge($options, ['transport' => 'tcp']));
    }
927201
protected function init($dsn, $username, $password, array $options = [])
    {
        try {
            //With parameters of method scope, because if there is a exception, this object is destroyed
            parent::__construct($dsn, $username, $password, $options);
            $this->setAttribute(PDO::ATTR_STATEMENT_CLASS, ['\cordillera\middlewares\db\Statement', [$this]]);
        } catch (\PDOException $e) {
            logger()->critical('DB connection failed', [
                    'dsn' => $dsn,
                    'username' => $username,
                    'password' => $password,
                    'options' => $options,
                ]);
            throw new Exception($e->getMessage(), 500, Exception::DBCONNECTION);
        }
    }
762971
protected function _parseOptions($fieldName, $options)
    {
        $options = parent::_parseOptions($fieldName, $options);
        $options += ['id' => $this->_domId($fieldName)];
        if (is_string($options['label'])) {
            $options['label'] = ['text' => $options['label']];
        }

        return $options;
    }
153021
private function removeHeader($name, array &$options)
    {
        foreach (array_keys($options['_headers']) as $key) {
            if (!strcasecmp($key, $name)) {
                unset($options['_headers'][$key]);
                return;
            }
        }
    }
681973
protected function addServer($host, array $options = [])
    {
        $port = isset($options['port']) && !empty($options['port']) ? $options['port'] : 11211;
        $weight = isset($options['weight']) && !empty($options['weight']) ? $options['weight'] : 0;

        $this->memcached->addServer($host, $port, $weight);
    }
1360204
public function routeHostname($hostname)
    {
        $hostname = env('BOOMCMS_HOST', $hostname);

        $site = Site::findByHostname($hostname);
        $site = $site ?: Site::findDefault();

        return $this->setActiveSite($site);
    }
148080
function setInitializers($options)
    {
        foreach ($options as $key => $v) {
            if (!(is_array($v) || $v instanceof iContainerInitializer))
                $v = array($key => $v);

            $this->addInitializer($v);
        }

        return $this;
    }
733386
public function fromArray($options)
    {
        if (isset($options['Name'])) {
            Validate::isString($options['Name'], 'options[Name]');
            $this->_name = $options['Name'];
        }

        if (isset($options['Address'])) {
            Validate::isString($options['Address'], 'options[Address]');
            $this->_address = $options['Address'];
        }

        if (isset($options['SubnetPrefixLength'])) {
            Validate::isString($options['SubnetPrefixLength'], 'options[SubnetPrefixLength]');
            $this->_subnetPrefixLength = $options['SubnetPrefixLength'];
        }
    }
300088
protected function resolveHostname($hostname)
    {
        if (false !== filter_var($hostname, FILTER_VALIDATE_IP)) {
            return \React\Promise\resolve($hostname);
        }

        return $this->getResolver()->resolve($hostname);
    }
187316
public function extractParts($hostname)
    {
        $suffix = $this->extractSuffix($hostname);

        if ($suffix === $hostname) {
            return [null, $hostname, null];
        }

        if (null !== $suffix) {
            $hostname = Str::substr($hostname, 0, -Str::length($suffix) - 1);
        }

        $lastDot = Str::strrpos($hostname, '.');

        if (false === $lastDot) {
            return [null, $hostname, $suffix];
        }

        $subDomain = Str::substr($hostname, 0, $lastDot);
        $host = Str::substr($hostname, $lastDot + 1);

        return [
            $subDomain,
            $host,
            $suffix
        ];
    }
301944
protected function createHeaders(RequestInterface $request, array $options)
	{
		$headers         = [];
		$request_headers = $request->getHeaders();

		foreach ($request_headers as $name => $values) {
			$header = strtoupper($name);

			// cURL does not support 'Expect-Continue', skip all 'EXPECT' headers
			if ($header === 'EXPECT') {
				continue;
			}

			if ($header === 'CONTENT-LENGTH') {
				if (array_key_exists(CURLOPT_POSTFIELDS, $options)) {
					$values = [strlen($options[CURLOPT_POSTFIELDS])];
				}
				// Force content length to '0' if body is empty
				else if (!array_key_exists(CURLOPT_READFUNCTION, $options)) {
					$values = [0];
				}
			}

			foreach ($values as $value) {
				$headers[] = $name.': '.$value;
			}
		}

		// Although cURL does not support 'Expect-Continue', it adds the 'Expect'
		// header by default, so we need to force 'Expect' to empty.
		$headers[] = 'Expect:';

		return $headers;
	}
1097717
public function _init($options)
    {
		if(is_array($options)) {
			foreach($options as $opt_name => $opt_val) {
				if(property_exists($this, $opt_name)) {
					$this->$opt_name = $opt_val;
				}
			}
		}
    }