Maps a string to a response which is then rendered.

@param string The requested URI.

@return void
183242
function dispatch($uri) {

    # E_USER_ERROR|E_USER_WARNING|E_USER_NOTICE|E_RECOVERABLE_ERROR = 5888
    $old_handler = set_error_handler(array($this, 'error_handler'), 5888);

    ob_start();
    $level = ob_get_level();

    $this->map_uri_to_response($this->clean_request_uri((string) $uri))->output();

    while (ob_get_level() >= $level) {
      ob_end_flush();
    }

    if (isset($old_handler)) {
      set_error_handler($old_handler);
    }
  }
722515
public function redirect(string $url): void {
		if (!filter_var($url, FILTER_VALIDATE_URL)) {
			throw new ResponseException("Invalid URL: $url", ResponseException::INVALID_URL);
		}
		
		$this->setType("redirect");
		$this->data["url"] = $url;
	}
1368393
public function execute($uri)
    {
        foreach ($this->routes as $pattern => $callback) {
            if (preg_match($pattern, $uri, $params) === 1) {
                call_user_func_array($this->beforeRouteCallback, $params);
                array_shift($params);

                return call_user_func_array($callback, array_values($params));
            } else {
                error_log("$pattern did not match $uri");
            }
        }
    }
1352354
public function writeString($string) {

            $this->stream->writeInt(strlen($string));
            $this->stream->writeBuffer($string);

        }
913424
protected function _respond( $string )
	{
		// if no view isset create one with the output buffer
		if ( is_null( $this->view ) ) 
		{
			$this->theme->content = $string;
		} else {
			$this->theme->content = $this->view->render();
		}
		
		// dont render the theme? Or does the request force render in modal?
		if ( CCRequest::current()->args->force_modal || $this->modal ) 
		{
			return CCResponse::create( $this->theme->content, $this->status );
		}
		
		// render theme and return response
		return CCResponse::create( $this->theme->render(), $this->status );
	}
482486
public function setUrl( $url )
	{
		if ( $url == $this->getUrl() ) { return; }

		$this->_values['url'] = (string) $url;
		$this->setModified();
	}
91411
public void bindString(int index, String value) {
        if (value == null) {
            throw new IllegalArgumentException("the bind value at index " + index + " is null");
        }
        bind(index, value);
    }
710541
private function checkResponse ($string) {
    if (substr($string, 0, 3) !== '+OK') {
      $this->error = array(
        'error' => "Server reported an error: $string",
        'errno' => 0,
        'errstr' => ''
      );

      if ($this->do_debug >= 1) {
        $this->displayErrors();
      }

      return false;
    } else {
      return true;
    }

  }
926776
public function setUriToken($uri = null)
	{
		$toSetUri = $uri;
		if(!$uri) {
			$toSetUri = $this->getUriPrefix().'tokens';
		}

		$this->_uriToken = $toSetUri;
	}
1080992
public function loadString($string)
    {
        $this->sourceString = $string;

        if ($this->config->allowPhpScripts === false) {
            $this->sourceString = preg_replace(
                '/<\\?.*(\\?>|$)/Us',
                '',
                str_replace('<?=', '<?php echo ', $this->sourceString)
            );
        }

        $this->sourceString = str_replace(
            [
                '__DIR__',
                '__FILE__',
            ],
            [
                "'" . $this->getSourceFileDirectory() . "'",
                "'" . $this->getSourceFilePath() . "'",
            ],
            $this->sourceString
        );

        return empty($this->sourceString);
    }
81398
public function renderResponse() {

		if(isset($this->methodName)) {
			$methodName = $this->methodName;
			$this->$methodName()->send();
		}
		else {
			$this->execute()->send();
		}

	}
79001
function requestURI( $uri )
    {
        $parsed = parse_url( $uri );

        $return = '';
        if ( isset( $parsed['user'] ) )
        {
            $return .= $parsed['user'] . '@' . $parsed['pass'];
        }
        $return .= rtrim( $parsed['path'], '/' ) . '/' . $this->Name;

        if ( isset( $parsed['query'] ) )
        {
            $return  .= '?' . $parsed['query'];
        }
        if ( isset( $parsed['fragment'] ) )
        {
            $return .= '#' . $parsed['fragment'];
        }

        return $return;
    }
1314380
public function generateValidURLSegment($string)
    {
        // Generate URL Segment:
        
        $this->owner->URLSegment = $this->owner->generateURLSegment($string);
        
        // Check for Duplicates:
        
        $count = 2;
        
        while (!$this->owner->validURLSegment()) {
            
            $this->owner->URLSegment = sprintf(
                '%s-%d',
                preg_replace('/-[0-9]+$/', '', $this->owner->URLSegment),
                $count
            );
            
            $count++;
            
        }
    }
983726
private function parseResponse($response) {
        $response = trim($response);
        $this->responseStatus = (int) substr($response, 0, 3);
        $this->response = substr($response, 4);
    }
737509
public function execute($string)
    {
        $string = strtolower((string) $string);
        if (!preg_match(self::PATTERN, $string)) {
            return null;
        }

        if ($string{0} === 't' || $string{0} === '1') {
            return true;
        } else {
            return false;
        }
    }
67019
public static function decode($string)
    {
        return ($string === self::NULL) ? null : strtr($string, self::$decodeMap);
    }
583048
static function redirect($uri) {
        // Check first if given string is a valid URL 
        if (!filter_var($uri, FILTER_VALIDATE_URL)) {
            throw new \Lollipop\Exception\Argument('URL is invalid', true);
        }
        
        header('location: ' . $uri);
        exit();
    }