Method to load the system URI strings for the application.

@param   string  $requestUri  An optional request URI to use instead of detecting one from the
server environment variables.

@return  void

@since   1.0
431400
protected function loadSystemUris($requestUri = null)
	{
		// Set the request URI.
		// @codeCoverageIgnoreStart
		if (!empty($requestUri))
		{
			$this->set('uri.request', $requestUri);
		}
		else
		{
			$this->set('uri.request', $this->detectRequestUri());
		}

		// @codeCoverageIgnoreEnd

		// Check to see if an explicit base URI has been set.
		$siteUri = trim($this->get('site_uri'));

		if ($siteUri != '')
		{
			$uri = new Uri($siteUri);
		}
		else
		// No explicit base URI was set so we need to detect it.
		{
			// Start with the requested URI.
			$uri = new Uri($this->get('uri.request'));

			// If we are working from a CGI SAPI with the 'cgi.fix_pathinfo' directive disabled we use PHP_SELF.
			if (strpos(php_sapi_name(), 'cgi') !== false && !ini_get('cgi.fix_pathinfo') && !empty($_SERVER['REQUEST_URI']))
			{
				// We aren't expecting PATH_INFO within PHP_SELF so this should work.
				$uri->setPath(rtrim(dirname($_SERVER['PHP_SELF']), '/\\'));
			}
			else
			// Pretty much everything else should be handled with SCRIPT_NAME.
			{
				$uri->setPath(rtrim(dirname($_SERVER['SCRIPT_NAME']), '/\\'));
			}

			// Clear the unused parts of the requested URI.
			$uri->setQuery(null);
			$uri->setFragment(null);
		}

		// Get the host and path from the URI.
		$host = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port'));
		$path = rtrim($uri->toString(array('path')), '/\\');

		// Check if the path includes "index.php".
		if (strpos($path, 'index.php') !== false)
		{
			// Remove the index.php portion of the path.
			$path = substr_replace($path, '', strpos($path, 'index.php'), 9);
			$path = rtrim($path, '/\\');
		}

		// Set the base URI both as just a path and as the full URI.
		$this->set('uri.base.full', $host . $path . '/');
		$this->set('uri.base.host', $host);
		$this->set('uri.base.path', $path . '/');

		// Set the extended (non-base) part of the request URI as the route.
		$this->set('uri.route', substr_replace($this->get('uri.request'), '', 0, strlen($this->get('uri.base.full'))));

		// Get an explicitly set media URI is present.
		$mediaURI = trim($this->get('media_uri'));

		if ($mediaURI)
		{
			if (strpos($mediaURI, '://') !== false)
			{
				$this->set('uri.media.full', $mediaURI);
				$this->set('uri.media.path', $mediaURI);
			}
			else
			{
				// Normalise slashes.
				$mediaURI = trim($mediaURI, '/\\');
				$mediaURI = !empty($mediaURI) ? '/' . $mediaURI . '/' : '/';
				$this->set('uri.media.full', $this->get('uri.base.host') . $mediaURI);
				$this->set('uri.media.path', $mediaURI);
			}
		}
		else
		// No explicit media URI was set, build it dynamically from the base uri.
		{
			$this->set('uri.media.full', $this->get('uri.base.full') . 'media/');
			$this->set('uri.media.path', $this->get('uri.base.path') . 'media/');
		}
	}
1269349
protected function createWhenUri($uri)
    {
        $when = static::$firing['when'];

        if (substr($when, -1) !== '/') {
            $when .= '/';
        }

        if(substr($uri, 0,1) === '/'){
            $uri = substr($uri, 1, strlen($uri));
        }

        return $when.$uri;
    }
1226975
function loadURIRoot( $uri, $displayErrors = true, &$extraParameters )
    {
        $res = "";
        $template = "";
        $resobj = $this->resourceFor( $uri, $res, $template );

        if ( !is_object( $resobj ) )
        {
            if ( $displayErrors )
                $this->warning( "", "No resource handler for \"$res\" and no default resource handler, aborting." );
            return null;
        }

        $canCache = true;
        if ( !$resobj->servesStaticData() )
            $canCache = false;
        if ( !$this->isCachingAllowed() )
            $canCache = false;

        $resourceData = $this->loadURIData( $resobj, $uri, $res, $template, $extraParameters, $displayErrors );

        if ( $resourceData )
        {
            eZTemplate::appendTemplateToStatisticsIfNeeded( $resourceData['template-name'], $resourceData['template-filename'] );
            $this->appendTemplateFetch( $resourceData['template-filename'] );

            if ( !$resourceData['compiled-template'] and
                 $resourceData['root-node'] === null )
            {
                $resourceData['root-node'] = array( eZTemplate::NODE_ROOT, false );
                $templateText = $resourceData["text"];
                $keyData = $resourceData['key-data'];
                $this->setIncludeText( $uri, $templateText );
                $rootNamespace = '';
                $this->parse( $templateText, $resourceData['root-node'], $rootNamespace, $resourceData );

                if ( eZTemplate::isDebugEnabled() )
                {
                    $this->appendDebugNodes( $resourceData['root-node'], $resourceData );
                }

                if ( $canCache )
                    $resobj->setCachedTemplateTree( $keyData, $uri, $res, $template, $extraParameters, $resourceData['root-node'] );
            }
            if ( !$resourceData['compiled-template'] and
                 $canCache and
                 $this->canCompileTemplate( $resourceData, $extraParameters ) )
            {
                $generateStatus = $this->compileTemplate( $resourceData, $extraParameters );
                if ( $generateStatus )
                    $resourceData['compiled-template'] = true;
            }
        }

        return $resourceData;
    }
806831
public static function post($requestUri, array $postData = [], array $requestHeaders = [])
    {
        return new self(
            'POST',
            $requestUri,
            \array_merge(
                $requestHeaders,
                ['Content-Type' => 'application/x-www-form-urlencoded']
            ),
            \http_build_query($postData, '&')
        );
    }
944360
public function setUri( $uri )
    {
        $uri = (string) $uri;

        if ( empty( $uri ) )
        {
            $uri = '#';
        }
        else if ( ! preg_match( '(^(' . static::VALID_SCHEMES . '))', $uri ) )
        {
            if ( preg_match( '(^[a-z0-9-]+(\.[a-z0-9-]+)+(/.*)?$)', $uri ) )
            {
                $uri = static::DEFAULT_SCHEME . $uri;
            }
            else
            {
                $uri = '/' . ltrim( $uri, '/' );
            }
        }

        $this->uri = $uri;
        return $this;
    }
1186116
private static function parseURI($uri){
        //Remove protocol (for clarity).
        $uri = substr($uri, strlen('mmap://'));
        $parts = explode('?', $uri);

        $file_name_block_size = explode(':', $parts[0]);

        if(!isset($file_name_block_size[1])){
            throw new \Exception(sprintf('%s is not a valid uri', $uri));
        }

        $parsed = [];

        list($parsed['file_name'], $parsed['block_size']) = $file_name_block_size;

        if(isset($parts[1])){
            //Extra params
            parse_str($parts[1], $parsed['options']);
        } else {
            $parsed['options'] = [];
        }

        return $parsed;
    }
1319402
public static void setRequestURI(final HttpServletRequest request, final String requestURI) {
		request.getSession(true).setAttribute(STORE_URI_KEY, requestURI);
	}
503734
protected function _loadFrom($uri) {
    if (empty($uri)) {
      return;
    }

    $response = $this->_client->request(Recurly_Client::GET, $uri);
    $response->assertValidResponse();

    $this->_objects = array();
    $this->__parseXmlToUpdateObject($response->body);
    $this->_afterParseResponse($response, $uri);
  }
793113
public function setOverride($uri)
    {
        if (is_string($uri)) {
            $uri = new Uri($uri);
        }

        Assert::nullOrIsInstanceOf($uri, UriInterface::class, 'Expected a string, UriInterface, or null. Got: %s');

        $this->override = $uri;
    }
931062
public function resolveUriPath()
    {
        if(!$this->server)
            return;

        list($requestUri) = explode('?', $this->server['REQUEST_URI']);

        if(strpos($requestUri, $this->server['SCRIPT_NAME']) === 0)
        {
            $basePath = $this->server['SCRIPT_NAME'];
        }
        else
        {
            $basePath = explode('/', $this->server['SCRIPT_NAME']);
            array_pop($basePath);
            $basePath = implode('/', $basePath);
        }

        $requestUri = trim($requestUri, '/');

        $requestUri = '/'.trim(substr($requestUri, strlen(trim($basePath, '/'))), '/');

        $this->uri->setPath($requestUri);
    }
408511
public function setRequestUri(string $requestUri) : Request
    {
        $pos = strpos($requestUri, '?');

        if ($pos === false) {
            $this->path = $requestUri;
            $this->queryString = '';
            $this->query = [];
        } else {
            $this->path        = substr($requestUri, 0, $pos);
            $this->queryString = substr($requestUri, $pos + 1);

            if ($this->queryString === '') {
                $this->query = [];
            } else {
                parse_str($this->queryString, $this->query);
            }
        }

        $this->requestUri = $requestUri;

        return $this;
    }
1167209
public function setProxy($proxyUri, $requestFullUri = false)
    {
        $this->proxyUri = $proxyUri;
        $this->requestFullUri = $requestFullUri;

        $this->socketClient->setContext($this->getContext());
    }
1118955
public function uri($name, $baseUri = null)
    {

        if (empty($baseUri)) {
            $baseUri = $this->baseUri;
        }

        return $baseUri . $this->get($name);
    }
150759
private function readNameValuePair(int $requestId, ?string &$buffer): void
    {
        $nameLength  = $this->readFieldLength($buffer);
        $valueLength = $this->readFieldLength($buffer);

        $contentFormat = (
            'a'.$nameLength.'name/'.
            'a'.$valueLength.'value/'
        );

        $content = unpack($contentFormat, $buffer);
        $this->requests[$requestId]['params'][$content['name']] = $content['value'];

        $buffer = substr($buffer, $nameLength + $valueLength);
    }
1095796
public static function init(string $uri = null): void
    {
        if (!defined('KOLDY_CLI')) {
            // KOLDY_CLI is not defined, which probably means useConfig() wasn't called
            static::terminateWithError('Don\'t call \Koldy\Application::run() before calling useConfig(). Check the documentation');
        }

        spl_autoload_register('\Koldy\Application::autoload');

        // set the error reporting in development mode
        if (static::inDevelopment()) {
            error_reporting(-1);
        }

        $config = static::getConfig('application');

        date_default_timezone_set($config->get('timezone', 'UTC'));

        $includePaths = [];
        $basePath = static::getApplicationPath();

        // register include path of application itself
        $includePaths[] = $basePath . 'controllers';

        if (is_dir($basePath . 'library')) {
            $includePaths[] = $basePath . 'library';
        }

        // adding additional include paths if there are any
        $additionalIncludePath = $config->get('additional_include_path') ?? [];

        // set the include path
        static::addIncludePath($includePaths, $additionalIncludePath);

        // set the error handler
        set_error_handler(function ($errorNumber, $errorMessage, $errorFile, $errorLine) {
            if (!(error_reporting() & $errorNumber)) {
                // This error code is not included in error_reporting
                return;
            }

            switch ($errorNumber) {
                case E_USER_ERROR:
                    $logMessage = new \Koldy\Log\Message('error');
                    $logMessage->addPHPErrorMessage($errorMessage, $errorFile, $errorNumber, $errorLine);
                    Log::message($logMessage);
                    break;

                case E_USER_WARNING:
                case E_DEPRECATED:
                case E_STRICT:
                    $logMessage = new \Koldy\Log\Message('warning');
                    $logMessage->addPHPErrorMessage($errorMessage, $errorFile, $errorNumber, $errorLine);
                    Log::message($logMessage);
                    break;

                case E_USER_NOTICE:
                    $logMessage = new \Koldy\Log\Message('notice');
                    $logMessage->addPHPErrorMessage($errorMessage, $errorFile, $errorNumber, $errorLine);
                    Log::message($logMessage);
                    break;


                default:
                    $logMessage = new \Koldy\Log\Message('warning');
                    $logMessage->addPHPErrorMessage($errorMessage, $errorFile, $errorNumber, $errorLine);
                    Log::message($logMessage);
                    break;
            }

            /* Don't execute PHP internal error handler */
            return true;
        });

        // register PHP fatal errors
        register_shutdown_function(function () {
            if (!defined('KOLDY_FATAL_ERROR_HANDLER')) {
                // to prevent possible recursion if you run into problems with logger
                define('KOLDY_FATAL_ERROR_HANDLER', true);

                $fatalError = error_get_last();

                if ($fatalError !== null && $fatalError['type'] == E_ERROR) {
                    $errorNumber = E_ERROR;
                    $errorMessage = $fatalError['message'];
                    $errorFile = $fatalError['file'];
                    $errorLine = $fatalError['line'];

                    $logMessage = new \Koldy\Log\Message('error');
                    $logMessage->addPHPErrorMessage($errorMessage, $errorFile, $errorNumber, $errorLine);

                    Log::error($logMessage);
                }
            }
        });

        // check the log for any enabled adapter
        $logConfigs = static::getConfig('application')->get('log', []);
        $logConfigsCount = count($logConfigs);
        $logEnabled = false;

        for ($i = 0; $i < $logConfigsCount && !$logEnabled; $i++) {
            if (isset($logConfigs[$i]['enabled']) && $logConfigs[$i]['enabled'] === true) {
                $logEnabled = true;
            }
        }

        if ($logEnabled) {
            // TODO: Don't init if we don't have to and let's do the "post" work after request
            Log::init();
        }
    }
830291
public function setUriCustomer( $uri = null)
	{
		$toSetUri = $uri;
		if(!$uri) {
			$toSetUri = $this->getUriPrefix().'customers';
		}

		$this->_uriCustomer = $toSetUri;
	}
853486
public void setURI( URI uri )
    {

        if ( uri == null )
        {
            setScheme( null );
            setUserInfo( null );
            setHost( null );
            setPort( UNDEFINED_PORT );
            setPath( null );
            setQuery( null );
            setFragment( null );
        }
        else if ( uri.isOpaque() )
        {
            setUserInfo( null );
            setHost( null );
            setPort( UNDEFINED_PORT );
            setPath( null );
            setQuery( null );
            setOpaque( uri.getScheme(), uri.getSchemeSpecificPart() );
            setFragment( uri.getRawFragment() );
        }
        else
        {
            setSchemeSpecificPart( null );
            setScheme( uri.getScheme() );
            setUserInfo( uri.getRawUserInfo() );
            setHost( uri.getHost() );
            setPort( uri.getPort() );
            setPath( uri.getRawPath() );
            setQuery( uri.getRawQuery() );
            setFragment( uri.getRawFragment() );
        }
    }