Get the matching control for the current request
- optionally, force a trailing slash on current request

@return mixed|null
437462
public function match()
    {
        // if forceSlash is ON, and there is no trailing slash on current request
        if ($this->forceSlash && !$this->hasTrailingSlash($this->uriRelative)) {
            $this->forceSlash();
        }
        // Find control for current request, first with exact matching, then with variable matching
        if ($this->matchExact() || $this->matchVariable()) {
            return $this->control; // Match found
        }

        return null; // No match found
    }
1171314
public function getRequestTarget()
    {
        if ($this->requestTarget !== null) {
            return $this->requestTarget;
        }

        if (!$this->uri) {
            return '/';
        }

        $requestTarget = $this->getUri()->getPath();
        if ($query = $this->getUri()->getQuery()) {
            $requestTarget .= sprintf('?%s', $query);
        }

        return empty($requestTarget) ? '/' : $requestTarget;
    }
184588
protected function getCacheControlHeader()
    {
        $cacheControl = '';
        foreach ($this->cacheDirectives as $cacheDirective) {
            $cacheControl .= ($cacheDirective !== '' ? $cacheDirective . ', ' : '');
        }
        $cacheControl = trim($cacheControl, ' ,');
        return ($cacheControl === '' ? null : $cacheControl);
    }
1265738
public function matchesRequest()
    {
        return ! is_null($this->payload->get('actorId')) && $this->payload->get('resource') === 'messages' && $this->payload->get('event') === 'created';
    }
468922
public function getController()
    {
        if (is_null($this->_controller)) {
            $controller = $this->getConfiguration()
                ->get('router.controller', 'pages');
            if (isset($this->_params['controller'])) {
                $controller = $this->_params['controller'];
            }
            $this->_controllerName = $controller;
            $this->_controller = trim(
                "{$this->namespace}\\". ucfirst($controller),
                '\\'
            );
        }
        return $this->_controller;
    }
168298
protected function getReturnUrl()
    {
        $controllerKey = \OxidEsales\Eshop\Core\Registry::getControllerClassNameResolver()->getIdByClassName(get_class());
        return $this->getSession()->processUrl($this->getBaseUrl() . "&cl=" . $controllerKey . "&fnc=getExpressCheckoutDetails");
    }
459430
protected function fetchControllerSuffix()
	{
		// Validate that we have a map to handle the given HTTP method.
		if (!isset($this->suffixMap[$this->input->getMethod()]))
		{
			throw new \RuntimeException(sprintf('Unable to support the HTTP method `%s`.', $this->input->getMethod()), 404);
		}

		// Check if request method is POST
		if ($this->methodInPostRequest == true && strcmp(strtoupper($this->input->server->getMethod()), 'POST') === 0)
		{
			// Get the method from input
			$postMethod = $this->input->get->getWord('_method');

			// Validate that we have a map to handle the given HTTP method from input
			if ($postMethod && isset($this->suffixMap[strtoupper($postMethod)]))
			{
				return ucfirst($this->suffixMap[strtoupper($postMethod)]);
			}
		}

		return ucfirst($this->suffixMap[$this->input->getMethod()]);
	}
1217473
public static function getUrl()
    {
        if (static::isCLI()) {
            return null;
        }

        if (static::$url === null) {
            $url = 'http';
            if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') {
                $url .= 's';
            }
            $url .= '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
            static::$url = new Url($url);
        }

        return static::$url;
    }
204498
public function getRequest()
    {
        if (! $this->request) {
            $this->request = \Zend_Controller_Front::getInstance()->getRequest();
        }
        return $this->request;
    }
888925
protected function getRequest()
    {
        // Check if current request handler has a request object
        $controller = $this->getController();
        if ($controller && !($controller->getRequest() instanceof NullHTTPRequest)) {
            return $controller->getRequest();
        }
        // Fall back to current controller
        if (Controller::has_curr() && !(Controller::curr()->getRequest() instanceof NullHTTPRequest)) {
            return Controller::curr()->getRequest();
        }
        return null;
    }
520252
private function getRequestedRole()
    {
        $uri = $_SERVER['REQUEST_URI'];

        if( $this->root != '/' && substr( $uri, 0, strlen($this->root) ) === $this->root )
        {
            $uri = substr( $uri, strlen( $this->root ) );
        }

        $questionMarkPosition = strpos( $uri, '?' );
        if( $questionMarkPosition !== false )
        {
            $uri = substr( $uri, 0, $questionMarkPosition );
        }

        return $uri;
    }
1071478
public function getRequest()
    {
        if (!$this->getContainer()->has(ServerRequestInterface::class)) {
            $this->getContainer()->share(ServerRequestInterface::class,function(){
                $beforeIndexPosition = strpos($_SERVER['PHP_SELF'],'/index.php');
                /**
                 * If there is some string before /index.php then remove this string from REQUEST_URI
                 */
                if(false !== $beforeIndexPosition && $beforeIndexPosition > 0){
                    $scriptUrl =  substr($_SERVER['PHP_SELF'],0,$beforeIndexPosition);
                    $_SERVER['REQUEST_URI'] = str_replace(['/index.php',$scriptUrl],'',$_SERVER['REQUEST_URI']);
                }
                return  ServerRequestFactory::fromGlobals()->withHeader('content-type', $this->getContentType());
            });
        }

        /** @var ServerRequestInterface $request */
        $request = $this->validateContract($this->getContainer()->get(ServerRequestInterface::class),
            ServerRequestInterface::class);
        return $request;
    }
20658
public function controllerName() {
        $request = $this->stack->getCurrentRequest();
        if ($request instanceof Request) {
            $string = $request->get('_controller');
            $parts = explode('::', $string);
            $controller = $parts[0];
            $pattern = "#Controller\\\([a-zA-Z\\\]*)Controller#";
            $matches = array();
            preg_match($pattern, $controller, $matches);
            if (isset($matches[1])) {
                return strtolower(str_replace('\\', '_', $matches[1]));
            }

            return '';
        }

        return '';
    }
743961
public static function getCurrentAction()
    {
        $request = Request::instance();
        return $request->module() . '/' . $request->controller() . '/' . $request->action();
    }
1021032
private function control(){
		if ( $this->file && !isset($this->is_controlled) ){
      $ok = 1;
      if ( $this->plugin ){
        $this->register_plugin_classes($this->plugin_path());
      }
			ob_start();
			foreach ( $this->checkers as $appui_checker_file ){
				// If a checker file returns false, the controller is not processed
				// The checker file can define data and inc that can be used in the subsequent controller
        if ( bbn\mvc::include_controller($appui_checker_file, $this, true) === false ){
					$ok = false;
					break;
				}
			}
      if ( ($log = ob_get_contents()) && \is_string($log) ){
			  $this->obj->content = $log;
      }
      ob_end_clean();
      // If rerouted during the checkers
      if ( $this->is_rerouted ){
        $this->is_rerouted = false;
        return $this->control();
      }
      if ( !$ok ){
        return false;
      }
      $output = bbn\mvc::include_controller($this->file, $this);
      // If rerouted during the controller
      if ( $this->is_rerouted ){
        $this->is_rerouted = false;
        return $this->control();
      }
			if ( \is_object($this->obj) && !isset($this->obj->content) && !empty($output) ){
				$this->obj->content = $output;
			}
      $this->is_controlled = 1;
		}
		return $this->is_controlled ? true : false;
	}
584981
public function get_active_controller() {
        if ($gradingmethod = $this->get_active_method()) {
            $controller = $this->get_controller($gradingmethod);
            if ($controller->is_form_available()) {
                return $controller;
            }
        }
        return null;
    }
392840
public function getRequestedControllerName()
    {
        if (isset($this->_routingInfo['requested_controller'])) {
            return $this->_routingInfo['requested_controller'];
        }
        if (($this->_rewritedPathInfo !== null) && isset($this->_rewritedPathInfo[1])) {
            return $this->_rewritedPathInfo[1];
        }
        return $this->getControllerName();
    }