Parses the scheme-specific portion of the URI and place its parts into instance variables.

@throws Exception
@return void
646
protected function parseUri($uriString = '')
  {
    $status = @preg_match("~^((//)([^/?#]*))([^?#]*)(\?([^#]*))?(#(.*))?$~", $uriString, $matches);

    if($status === FALSE)
    {
      throw new Exception("URI scheme-specific decomposition failed");
    }

    if(!$status) return;

    $this->path = (isset($matches[4])) ? $matches[4] : '';
    $this->query = (isset($matches[6])) ? $matches[6] : '';
    $this->fragment = (isset($matches[8])) ? $matches[8] : '';

    $status = @preg_match("~^(([^:@]*)(:([^@]*))?@)?((?(?=[[])[[][^]]+[]]|[^:]+))(:(.*))?$~", (isset($matches[3])) ? $matches[3] : "", $matches);

    if($status === FALSE)
    {
      throw new Exception("URI scheme-specific authority decomposition failed");
    }

    if(!$status) return;

    $this->user = isset($matches[2]) ? $matches[2] : "";
    $this->pass = isset($matches[4]) ? $matches[4] : "";
    $this->host = isset($matches[5]) === TRUE ? preg_replace('~^\[([^]]+)\]$~', '\1', $matches[5]) : "";
    $this->port = isset($matches[7]) ? $matches[7] : "";
  }
1298930
public function parse()
    {
        if ($this->isParsed || $this->uriPattern === null || $this->uriPattern === '') {
            return;
        }
        $this->routeParts = [];
        $currentRoutePartIsOptional = false;
        if (substr($this->uriPattern, -1) === '/') {
            throw new InvalidUriPatternException('The URI pattern "' . $this->uriPattern . '" of route "' . $this->getName() . '" ends with a slash, which is not allowed. You can put the trailing slash in brackets to make it optional.', 1234782997);
        }
        if ($this->uriPattern[0] === '/') {
            throw new InvalidUriPatternException('The URI pattern "' . $this->uriPattern . '" of route "' . $this->getName() . '" starts with a slash, which is not allowed.', 1234782983);
        }

        $matches = [];
        preg_match_all(self::PATTERN_EXTRACTROUTEPARTS, $this->uriPattern, $matches, PREG_SET_ORDER);

        /** @var $lastRoutePart RoutePartInterface */
        $lastRoutePart = null;
        foreach ($matches as $match) {
            $routePartType = empty($match['dynamic']) ? self::ROUTEPART_TYPE_STATIC : self::ROUTEPART_TYPE_DYNAMIC;
            $routePartName = $match['content'];
            if (!empty($match['optionalStart'])) {
                if ($lastRoutePart !== null && $lastRoutePart->isOptional()) {
                    throw new InvalidUriPatternException('the URI pattern "' . $this->uriPattern . '" of route "' . $this->getName() . '" contains successive optional Route sections, which is not allowed.', 1234562050);
                }
                $currentRoutePartIsOptional = true;
            }
            $routePart = null;
            switch ($routePartType) {
                case self::ROUTEPART_TYPE_DYNAMIC:
                    if ($lastRoutePart instanceof DynamicRoutePartInterface) {
                        throw new InvalidUriPatternException('the URI pattern "' . $this->uriPattern . '" of route "' . $this->getName() . '" contains successive Dynamic Route Parts, which is not allowed.', 1218446975);
                    }
                    if (isset($this->routePartsConfiguration[$routePartName]['handler'])) {
                        $routePart = $this->objectManager->get($this->routePartsConfiguration[$routePartName]['handler']);
                        if (!$routePart instanceof DynamicRoutePartInterface) {
                            throw new InvalidRoutePartHandlerException(sprintf('routePart handlers must implement "%s" in route "%s"', DynamicRoutePartInterface::class, $this->getName()), 1218480972);
                        }
                    } elseif (isset($this->routePartsConfiguration[$routePartName]['objectType'])) {
                        $routePart = new IdentityRoutePart();
                        $routePart->setObjectType($this->routePartsConfiguration[$routePartName]['objectType']);
                        if (isset($this->routePartsConfiguration[$routePartName]['uriPattern'])) {
                            $routePart->setUriPattern($this->routePartsConfiguration[$routePartName]['uriPattern']);
                        }
                    } else {
                        $routePart = new DynamicRoutePart();
                    }
                    $routePartDefaultValue = ObjectAccess::getPropertyPath($this->defaults, $routePartName);
                    if ($routePartDefaultValue !== null) {
                        $routePart->setDefaultValue($routePartDefaultValue);
                    }
                    break;
                case self::ROUTEPART_TYPE_STATIC:
                    $routePart = new StaticRoutePart();
                    if ($lastRoutePart !== null && $lastRoutePart instanceof DynamicRoutePartInterface) {
                        /** @var DynamicRoutePartInterface $lastRoutePart */
                        $lastRoutePart->setSplitString($routePartName);
                    }
            }
            $routePart->setName($routePartName);
            if ($currentRoutePartIsOptional) {
                $routePart->setOptional(true);
                if ($routePart instanceof DynamicRoutePartInterface && !$routePart->hasDefaultValue()) {
                    throw new InvalidRouteSetupException(sprintf('There is no default value specified for the optional route part "{%s}" of route "%s", but all dynamic optional route parts need a default.', $routePartName, $this->getName()), 1477140679);
                }
            }
            $routePart->setLowerCase($this->lowerCase);
            if (isset($this->routePartsConfiguration[$routePartName]['options'])) {
                $routePart->setOptions($this->routePartsConfiguration[$routePartName]['options']);
            }
            if (isset($this->routePartsConfiguration[$routePartName]['toLowerCase'])) {
                $routePart->setLowerCase($this->routePartsConfiguration[$routePartName]['toLowerCase']);
            }

            $this->routeParts[] = $routePart;
            if (!empty($match['optionalEnd'])) {
                if (!$currentRoutePartIsOptional) {
                    throw new InvalidUriPatternException('The URI pattern "' . $this->uriPattern . '" of route "' . $this->getName() . '" contains an unopened optional section.', 1234564495);
                }
                $currentRoutePartIsOptional = false;
            }
            $lastRoutePart = $routePart;
        }
        if ($currentRoutePartIsOptional) {
            throw new InvalidUriPatternException('The URI pattern "' . $this->uriPattern . '" of route "' . $this->getName() . '" contains an unterminated optional section.', 1234563922);
        }
        $this->isParsed = true;
    }
1174464
private function parseFacts(): void
    {
        // Split the record into facts
        if ($this->gedcom) {
            $gedcom_facts = preg_split('/\n(?=1)/s', $this->gedcom);
            array_shift($gedcom_facts);
        } else {
            $gedcom_facts = [];
        }
        if ($this->pending) {
            $pending_facts = preg_split('/\n(?=1)/s', $this->pending);
            array_shift($pending_facts);
        } else {
            $pending_facts = [];
        }

        $this->facts = [];

        foreach ($gedcom_facts as $gedcom_fact) {
            $fact = new Fact($gedcom_fact, $this, md5($gedcom_fact));
            if ($this->pending !== null && !in_array($gedcom_fact, $pending_facts, true)) {
                $fact->setPendingDeletion();
            }
            $this->facts[] = $fact;
        }
        foreach ($pending_facts as $pending_fact) {
            if (!in_array($pending_fact, $gedcom_facts, true)) {
                $fact = new Fact($pending_fact, $this, md5($pending_fact));
                $fact->setPendingAddition();
                $this->facts[] = $fact;
            }
        }
    }
683135
protected function parse()
    {
        try {
            // get parse context
            $ctx = $this->project->getReference(self::PARSING_CONTEXT_REFERENCE);
            if (null == $ctx) {
                // make a new context and register it with project
                $ctx = new PhingXMLContext($this->project);
                $this->project->addReference(self::PARSING_CONTEXT_REFERENCE, $ctx);
            }

            //record this parse with context
            $ctx->addImport($this->buildFile);

            if (count($ctx->getImportStack()) > 1) {
                $currentImplicit = $ctx->getImplicitTarget();
                $currentTargets = $ctx->getCurrentTargets();

                $newCurrent = new Target();
                $newCurrent->setProject($this->project);
                $newCurrent->setName('');
                $ctx->setCurrentTargets([]);
                $ctx->setImplicitTarget($newCurrent);

                // this is an imported file
                // modify project tag parse behavior
                $this->setIgnoreProjectTag(true);
                $this->_parse($ctx);
                $newCurrent->main();

                $ctx->setImplicitTarget($currentImplicit);
                $ctx->setCurrentTargets($currentTargets);
            } else {
                $ctx->setCurrentTargets([]);
                $this->_parse($ctx);
                $ctx->getImplicitTarget()->main();
            }
        } catch (Exception $exc) {
            //throw new BuildException("Error reading project file", $exc);
            throw $exc;
        }
    }
816499
function parse_request(){
		parent::parse_request();
		if (isset($_GET["id"]))
			$this->request->set_filter($this->config->id["name"],$_GET["id"],"=");
		else if (!$_POST["ids"])
			throw new Exception("ID parameter is missed");
	}
1306302
protected function setupParse()
    {
        $config = $this->app->config->get('parse');

        ParseClient::initialize($config['app_id'], $config['rest_key'], $config['master_key']);

        if (isset($config['server_url']) && isset($config['mount_path'])) {
            $serverURL = rtrim($config['server_url'], '/');
            $mountPath = trim($config['mount_path'], '/').'/';

            ParseClient::setServerURL($serverURL, $mountPath);
        }

        if (isset($config['session']) && $config['session'] === 'laravel') {
            ParseClient::setStorage(new ParseSessionStorage($this->app->session));
        }
    }
865821
protected function determineUri()
    {
        $params = $this->getServerParams();
        
        $parts = $this->mapUriPartsFromServerParams($params);
        
        if (
            isset($params['SERVER_PROTOCOL']) &&
            \Jasny\str_starts_with(strtoupper($params['SERVER_PROTOCOL']), 'HTTP/')
        ) {
            $parts['scheme'] = !empty($params['HTTPS']) && $params['HTTPS'] !== 'off' ? 'https' : 'http';
        }
        
        if (isset($parts['host'])) {
            list($parts['host']) = explode(':', $parts['host'], 2); // May include the port
        }
        
        if (isset($parts['path'])) {
            $parts['path'] = parse_url($parts['path'], PHP_URL_PATH); // Includes the query string
        }

        return new UriObject($parts);
    }
640591
private function _parse_token()
    {
        if (!$this->_controller || !$this->_action) {
            if (!$this->_action && isset($this->_vars['action']))
                $this->_action = $this->_vars['action']['value'];
            
            if (!$this->_to) {
                if (!isset($this->_vars['controller']) || !isset($this->_vars['action']))
                    return false;
                $this->_controller = $this->_vars['controller']['value'];
                $this->_action     = $this->_vars['action']['value'];
            } else {
                $to = $this->_has_variable_to() ? $this->_replace_variable_to($this->_controller, $this->_action) : $this->_to;
                try {
                    $token = new UrlToken($to);
                    list($this->_controller, $this->_action) = $token->parts();
                } catch (Exception $e) {
                    return false;
                }
            }
        }
        return true;
    }
874834
protected function parseRouting()
    {
        // Get routing routes
        $routes = $this->config->routes;
        $routing = $this->config->routing;

        // If no query strings are used, we will add all routes in the config.routes.php file. 
        // We modify these routes to be an array of a regex string and a callable
        $http_verb = isset($_SERVER['REQUEST_METHOD']) ? strtolower($_SERVER['REQUEST_METHOD']) : 'cli';

        foreach ($routes as $route => $value) 
        {
            // Check if the route format is using HTTP verbs
            if (is_int($route))
            {
                $route = $value;
                $value = array($this, 'defaultCallable');
            }
            elseif (is_array($value))
            {
                $value = array_change_key_case($value, CASE_LOWER);
                if (isset($value[$http_verb]))
                {
                    $value = $value[$http_verb];
                }
                else
                {
                    continue;
                }
            }

            // Convert wildcards to Regex
            $route = str_replace(array(':any', ':num'), array('[^/]+', '[0-9]+'), $route);

            $this->addRoute($route, $value, false);
        }
    }
695305
protected function parse($uri)
    {
        $uri     = (string) $uri;
        $matches = array();

        preg_match('!' . self::getPattern() . '!', $uri, $matches);

        $scheme    = isset($matches[2]) ? $matches[2] : null;
        $authority = isset($matches[4]) ? $matches[4] : null;
        $path      = isset($matches[5]) ? $matches[5] : null;
        $query     = isset($matches[7]) ? $matches[7] : null;
        $fragment  = isset($matches[9]) ? $matches[9] : null;

        $this->scheme    = $scheme;
        $this->authority = $authority;
        $this->path      = $path;
        $this->query     = $query;
        $this->fragment  = $fragment;

        $this->parseAuthority($authority);
        $this->parseParameters($query);
    }
600302
public function parse(){
		while($this->parser->hasText()){
			if(!preg_match('/\s+(.+?):\s*((\s*(".+?"|[^"]+?)\s*)(\s*,\s*(".+?"|[^"]+?)\s*)*)((;\s*})|(;|\}))/is', $this->parser->getText(), $matches)) throw new \Exception("Invalid property at '".substr($this->parser->getText(), 0, 20)."'");
			$this->parser->move(strlen($matches[0]));
			
			$this->propertySet->setProperty($matches[1], $matches[2]);
			
			if(strpos(end($matches), '}')) break;
		}
	}
1277630
static function parse_file( $f ){
		$src = file_get_contents( $f, true );
		if( $src === false ){
			throw new Exception("Cannot read file $f");
		}
		return self::parse_string( $src );
	}
1280337
protected function parse(): void
    {
        switch ($this->notation) {

            case self::NOTATION_DOT_DECIMAL:
                $this->fromDotDecimal($this->value);
                break;

            case self::NOTATION_BINARY:
                $this->fromBinary($this->value);
                break;

            case self::NOTATION_CIDR_SHORT:
                $this->fromCidrShort($this->value);
                break;

            case self::NOTATION_CIDR_LONG:
                $this->fromCidrLong($this->value);
                break;

            case self::NOTATION_CIDR_BINARY:
                $this->fromCidrBinary($this->value);
                break;

            default:
                $this->notation = self::NOTATION_INVALID;
        }
    }
1302820
public function parse(){
		if(!preg_match('/(.+?)\s*{/is', $this->parser->getText(), $matches)) throw new \Exception("Invalid selector at '".substr($this->getText(), 0, 20)."'");
		$this->parser->move(strlen($matches[0]));
		
		$selectors = array();
		foreach(explode(',', $matches[1]) as $selector){
			$selectors[] = self::parseSelector(trim($selector));
		}
		
		$ruleSet = new \csslib\RuleSet($selectors);
		$this->parent->add($ruleSet);
		
		$this->setPropertySet($ruleSet);
		parent::parse();
	}
719855
protected function _initialize(){

		// Fetch the complete URI string
		$this->uri->_fetch_uri_string();
		
		// Do we need to remove the URL suffix?
		$this->uri->_remove_url_suffix();

		// Compile the segments into an array
		$this->uri->_explode_segments();

		// Set Segments
		$this->segments = $this->uri->segments;


		// Parse any custom routing that may exist
		$this->_parseRoutes();

		// Re-index the segment array so that it starts with 1 rather than 0
		$this->uri->_reindex_segments();

	}
1211173
public function run() {
		if ($this->url === null) {
			throw new \Exception("No URL configured for redirection.");
		}
		if (strpos($this->url, '/') === 0 || strpos($this->url, 'http://') === 0 || strpos($this->url, 'https://') === 0) {
			$url = ValueUtils::val($this->url);
		} else {
			$url = ROOT_URL.ValueUtils::val($this->url);
		}
		header("Location: ".$url);
	}
1248735
public function parse($uri)
    {
        if (($scheme = static::parseScheme($uri)) !== null) {
            $this->setScheme($scheme);
            $uri = substr($uri, strlen($scheme) + 1);
        }

        $parts = explode(',', $uri, 2);

        if (count($parts) > 1) {
            $mimeType = array_shift($parts);
            if (';base64' === substr($mimeType, -7)) {
                $this->encoding = 'base64';
                $mimeType = substr($mimeType, 0, -7);
            }
            $this->setMimeType($mimeType);
        }

        $this->rawData = array_shift($parts);

        return $this;
    }