Modify url.
@param string|array $modify
@param array $config
@return null|string
@throws UrlException
554865
public static function modify($modify = null, array $config = [])
    {
        if (!isset($modify) || is_scalar($modify)) {
            return static::set($modify, $config)->get();
        }

        if (!is_array($modify)) {
            throw new UrlException('Argument "$modify" must be array.');
        }
        $url = current($modify);
        if (is_int(key($modify)) && !empty($url) && $url[0] !== '!') {
            $url = array_shift($modify);
        } else {
            $url = null;
        }
        $scheme = self::REL;
        if (isset($modify['@scheme'])) {
            $scheme = $modify['@scheme'];
            if ($modify['@scheme'] == self::ABS || $modify['@scheme'] == self::SHORT_ABS) {
                unset($modify['@scheme']);
            }
        }
        return static::modifyInternal(static::set($url, $config), $modify)->get($scheme);
    }
500965
public function modify(array $add = [], array $remove = [], $controller = NULL, $action = NULL) {
        $url_splitted = explode('?', $this->_config['request_path']);
        $path = array_filter(explode('/', reset($url_splitted)));

        $gets_remove = key_exists('query', $remove) ? $remove['query'] : [];
        if (key_exists('query', $remove)) {
            unset($remove['query']);
        }
        
        $url = array_filter(array_diff_key($path, array_fill_keys($remove, FALSE), $add) + $add, function ($var) {
            return ($var !== NULL && $var !== FALSE && $var !== '');
        });
        
        $gets_request = key_exists('query', $url) ? $url['query'] : [];
        
        if (key_exists('query', $url)) {
            unset($url['query']);
        }

        ksort($url);
        array_walk($url, function(&$v, $k) {
            $v = (is_string($k) ? $k . '-' : '') . $v;
        });
        
        $url_controller = $controller ? $controller : $this->_config['request_controller'];
        $url_action = $action ? $action : $this->_config['request_action'];

        $last_url = ($this->_config['root_dir'] ? '/' . $this->_config['root_dir'] : '') . 
            '/' . ( ($url_action == $this->_config['default_action'] && 
                $url_controller == $this->_config['default_controller'] && !$url)
                || ($this->_config['request_controller'] === NULL && $this->_config['request_action'] === NULL) ? '' : $url_controller . '/' ) .
            ( ($url_action == $this->_config['default_action'] && $url) || $url_action
                != $this->_config['default_action'] ? $url_action . '/' : '' ) . 
            implode('/', $url);
        
        $queries = array_filter(explode('&', $this->_config['request_queries']));
        $queries_keys = array_map(function($v){ $e = explode('=', $v); return $e[0]; }, $queries);
        $queries_vals = array_map(function($v){ $e = explode('=', $v); return $e[1]; }, $queries);
        
        $gets = $gets_request + array_combine($queries_keys, $queries_vals);
        foreach ($gets_remove as $gr) {
            if (key_exists($gr, $gets)) {
                unset($gets[$gr]);
            }
        } 
        array_walk($gets, function(&$v, $k, $path) {
            $v = $k . '=' . ($k == 'return' ? base64_encode($path) : $v);
        }, $this->_config['request_path']);
        
        return $last_url . ($gets ? (substr($last_url, -1) == '/' ? '' : '/') . '?' . implode('&', $gets) : '');
    }
1199914
public function config($config = null) {
		if ($config) {
			if (!is_array($config)) {
				return isset($this->_config[$config]) ? $this->_config[$config] : null;
			}
			$this->_config = $config + $this->_config;
		}
		return $this->_config;
	}
294633
public function modify($modify) : \DateTime /*self invariant*/
    {
        if ($this->frozen) {
            throw new \RuntimeException(get_class($this) . ' is read-only, frozen.');
        }
        return parent::modify($modify);
    }
1062942
protected function _setConfig($config)
    {
        if (strlen($config['url']) > 1 && $config['url'][0] === '/') {
            $config['url'] = substr($config['url'], 1);
        }

        if (empty($config['session'])) {
            $config['session'] = new Session([
                'cookiePath' => $config['base']
            ]);
        }

        $this->_environment = $config['environment'];
        $this->cookies = $config['cookies'];

        if (isset($config['uri']) && $config['uri'] instanceof UriInterface) {
            $uri = $config['uri'];
        } else {
            $uri = ServerRequestFactory::createUri($config['environment']);
        }

        // Extract a query string from config[url] if present.
        // This is required for backwards compatibility and keeping
        // UriInterface implementations happy.
        $querystr = '';
        if (strpos($config['url'], '?') !== false) {
            list($config['url'], $querystr) = explode('?', $config['url']);
        }
        if (strlen($config['url'])) {
            $uri = $uri->withPath('/' . $config['url']);
        }
        if (strlen($querystr)) {
            $uri = $uri->withQuery($querystr);
        }

        $this->uri = $uri;
        $this->base = $config['base'];
        $this->webroot = $config['webroot'];

        $this->url = substr($uri->getPath(), 1);
        $this->here = $this->base . '/' . $this->url;

        if (isset($config['input'])) {
            $stream = new Stream('php://memory', 'rw');
            $stream->write($config['input']);
            $stream->rewind();
        } else {
            $stream = new PhpInputStream();
        }
        $this->stream = $stream;

        $config['post'] = $this->_processPost($config['post']);
        $this->data = $this->_processFiles($config['post'], $config['files']);
        $this->query = $this->_processGet($config['query'], $querystr);
        $this->params = $config['params'];
        $this->session = $config['session'];
    }
638293
public function updateRouteConfig(array &$config)
    {
        if ($this->loadCachedConfig($config)) {
            return;
        }

        $routeList = $this->getRouteConfig($this->controllerList());

        if (!sizeof($routeList)) {
            return;
        }

        if (!isset($config['routes'])) {
            $config['routes'] = array();
        }

        $this->merger->merge($routeList, $config['routes']);
    }
1157665
protected function maybeInvalidConfig(Config $config): ?Error
    {
        $expected = (string) $config->get('url');

        return (empty($expected))
            ? ResultFactory::makeError($this, 'Expected URL not defined in preflight.toml.')
            : null;
    }
351291
protected function replaceVars($string, Config $config)
    {
        while (0 < preg_match_all('/\{\{([^\}]+)\}\}/', $string, $matches)) {
            foreach ($matches[0] as $i => $match) {
                $string = str_replace($match, $config->get($matches[1][$i]), $string);
            }
        }

        return $string;
    }
631868
protected static function modifyConfig($name, array $config, $override = false)
    {
        self::validateAgentName($name);
        if (!isset(self::$agentsConfig[$name])) {
            self::$agentsConfig[$name] = [];
        }
        $target = &self::$agentsConfig[$name];
        if ($override) {
            $target = $config;
        } else {
            $target = array_merge($target, $config);
        }
        if (self::hasAgent($name)) {
            self::getAgent($name)->config($target);
        }
    }
759597
public function configure(array $config)
    {
        return $this
            ->setGLSShipmentDeposit($config[Config::T8700])
            ->setCustomerCode($config[Config::T8915])
            ->setContactId($config[Config::T8914])
            ->clean();
    }
291953
public function config($config = null)
    {
        if (is_array($config)) {
            $this->_config = $config;
        } elseif (is_string($config)) {
            if (!empty($this->_config[$config])) {
                return $this->_config[$config];
            }

            return false;
        }

        return $this->_config;
    }
344618
function modifyContent(&$content) {
    	//Remove comments
		$content = preg_replace('#\/\*(?!\*\/)(.*?)\*\/#si', '', $content);
		$content = str_replace('<!--', '', $content);
		$content = str_replace('-->', '', $content);
		$content = trim($content);

		if (!isset($this->url)) return $content;
		$this->regex = array();
		$this->replace = array();

		$pathinfo = parse_url($this->url);

		$sorceurl = $pathinfo['scheme'] . '://' . $pathinfo['host'] . '/';

		$sorcepath = explode('/', $pathinfo['path']);
		array_shift($sorcepath);
		array_pop($sorcepath);

		$sorcepathoriginal = $sorcepath;

		while(count($sorcepath)) {
			$temp = $sorcepathoriginal;
			$path = '';
			foreach($sorcepath as $values) {
				$path .= '\.\.\/';
				array_pop($temp);
			}

			$turl = $sorceurl;
			if (count($temp)) {
				$turl .= implode('/', $temp) . '/';
			}
			$this->regex[] = '#' . $path . '#iSs';
			$this->replace[] = $turl;
			array_pop($sorcepath);
		}

		$this->thisUrl = $sorceurl . implode('/', $sorcepathoriginal) . '/';

		$this->regex[] = '#\.\/#is';
		$this->replace[] = $sorceurl . implode('/', $sorcepathoriginal) . '/';

		$this->regex[] = '#url\(([^"\'\)]*)\)#is';
		$this->replace[] = 'url("$1")';

		$this->regex[] = '#url\(["\']/([^"\']*)["\']\)#Sis';
		$this->replace[] = 'url("' . $sorceurl . '$1")';

		$this->regex[] = '#url\(["\'](?!\w{0,10}://)([^"\']*)["\']\)#Sis';
		$this->replace[] = 'url("' . $sorceurl . implode('/', $sorcepathoriginal) . '/$1")';

		$regexall = $this->regex;
		$replaceall = $this->replace;

		$content = preg_replace($regexall, $replaceall, $content);

		if (preg_match_all('#@import.*?[\'"]([^\'"]*)[\'"].*?;#Sis', $content, $imports)) {
			foreach ($imports[1] as $key => $import) {
				$cssparser = new Css($this->prefix);
				$cssparser->ParseUrl($import);
				$temp = $cssparser->GetCSS();

				$content = str_replace($imports[0][$key], '', $content );

				$content = $temp . $content;
			}
		}
		return $content;
	}
107062
function modify( $tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters, $placement )
    {
        $dom = $namedParameters['dom'];
        if ( $dom instanceof eZContentObjectAttribute )
        {
            $this->ObjectAttributeId = $dom->attribute( 'id' );
            $content = $dom->attribute( 'content' );
            $xmlData = $content->attribute( 'xml_data' );

            $domTree = new DOMDocument( '1.0', 'utf-8' );
            $domTree->preserveWhiteSpace = false;
            $success = $domTree->loadXML( $xmlData );

            $tocText = '';
            if ( $success )
            {
                $this->HeaderCounter = array();
                $this->LastHeaderLevel = 0;

                $rootNode = $domTree->documentElement;
                $tocText .= $this->handleSection( $rootNode );

                while ( $this->LastHeaderLevel > 0 )
                {
                    $tocText .= "</li>\n</ul>\n";
                    $this->LastHeaderLevel--;
                }
            }
        }
        $operatorValue = $tocText;
    }
1044555
public static ns_configtemplate modify(nitro_service client, ns_configtemplate resource) throws Exception
	{
		resource.validate("modify");
		return ((ns_configtemplate[]) resource.update_resource(client))[0];
	}
896808
public function generate(array $config)
    {
        $defaultHTTPCodes = $this->getDefaultHTTPCodes($config);
        $defaultOptions = $this->getDefaultOptions($config);

        return $this->createUrlChainFromConfig(
            $config,
            $defaultHTTPCodes,
            $defaultOptions
        );
    }
1259981
private function normalizeConfig(array $config)
    {
        // Backwards compatibility with old config format: `toolstack` is
        // changed to application `type` and `build`.`flavor`.
        if (isset($config['toolstack'])) {
            if (!strpos($config['toolstack'], ':')) {
                throw new InvalidConfigException("Invalid value for 'toolstack'");
            }
            list($config['type'], $config['build']['flavor']) = explode(':', $config['toolstack'], 2);
        }

        // The `web` section has changed to `web`.`locations`.
        if (isset($config['web']['document_root']) && empty($config['web']['locations'])) {
            $oldConfig = $config['web'] + $this->getOldWebDefaults();

            $location = &$config['web']['locations']['/'];

            $location['root'] = $oldConfig['document_root'];
            $location['expires'] = $oldConfig['expires'];
            $location['passthru'] = $oldConfig['passthru'];
            $location['allow'] = true;

            foreach ($oldConfig['whitelist'] as $pattern) {
                $location['allow'] = false;
                $location['rules'][$pattern]['allow'] = true;
            }

            foreach ($oldConfig['blacklist'] as $pattern) {
                $location['rules'][$pattern]['allow'] = false;
            }
        }

        return $config;
    }
979140
public function add($section, $config = array())
    {
        if (! isset($this->config[$section])) {
            $this->config[$section] = array();
        }

        $this->config[$section] = array_merge($this->config[$section], $config);
    }