Parse service name from request

@return string|boolean
372
protected function fetchService()
	{
        $service = $this->getRouteParam('service');
        $service = $this->parseCanonicalName($service, true);
        
        if (preg_match($this->servicePattern, $service)) {
            return $service;
        } else {
            return false;
        }
    }
882013
protected function _parseNameAddr()
    {
        $this->_rfc822ParsePhrase($personal);

        if ($ob = $this->_parseAngleAddr()) {
            $ob->personal = $personal;
            return $ob;
        }

        return false;
    }
746010
function _parse()
    {
        $this->serviceList = array();

        $services = $this->parser->evalXPath('xrd:Service', $this->xrdNode);

        foreach ($services as $node) {
            $s = new Auth_Yadis_Service();
            $s->element = $node;
            $s->parser = $this->parser;

            $priority = $s->getPriority();

            if ($priority === null) {
                $priority = SERVICES_YADIS_MAX_PRIORITY;
            }

            $this->_addService($priority, $s);
        }
    }
1373574
protected static function getDefaultService()
    {
        $service = (isset($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
        $parts = parse_url($service);

        if (isset($parts['query'])) {
            parse_str($parts['query'], $query);
        } else {
            $query = array();
        }
        unset($query['ticket']);
        $parts['query'] = http_build_query($query);

        return self::build_url($parts);
    }
157029
protected function getServiceNames()
    {
        $names = [];

        foreach ($this->getServices() as $name => $info) {
            if (!isset($info['type'])) {
                continue;
            }
            $names[$name] = $info['type'];
        }

        return $names;
    }
619646
public function getServiceDescription()
	{
		return array(
			$this->_name . '.init' => array(
				"parameters" => array(
					array( "type" => "string","name" => "site","optional" => false ),
					array( "type" => "array","name" => "items","optional" => false ),
				),
				"returns" => "array",
			),
			$this->_name . '.finish' => array(
				"parameters" => array(
					array( "type" => "string","name" => "site","optional" => false ),
					array( "type" => "array","name" => "items","optional" => false ),
				),
				"returns" => "array",
			),
			$this->_name . '.deleteItems' => array(
				"parameters" => array(
					array( "type" => "string","name" => "site","optional" => false ),
					array( "type" => "array","name" => "items","optional" => false ),
				),
				"returns" => "array",
			),
			$this->_name . '.saveItems' => array(
				"parameters" => array(
					array( "type" => "string","name" => "site","optional" => false ),
					array( "type" => "array","name" => "items","optional" => false ),
				),
				"returns" => "array",
			),
			$this->_name . '.searchItems' => array(
				"parameters" => array(
					array( "type" => "string","name" => "site","optional" => false ),
					array( "type" => "array","name" => "condition","optional" => true ),
					array( "type" => "integer","name" => "start","optional" => true ),
					array( "type" => "integer","name" => "limit","optional" => true ),
					array( "type" => "string","name" => "sort","optional" => true ),
					array( "type" => "string","name" => "dir","optional" => true ),
				),
				"returns" => "array",
			),
		);
	}
1039402
protected function parseName()
    {
        $start = $this->token->getStart();
        $token = $this->expect(Token::NAME_TYPE);

        return new Name($token->getValue(), $this->location($start));
    }
237689
public function parse()
    {
        if (array_key_exists('PHP_AUTH_USER', $_SERVER)) { // mod_php
            $this->name = $_SERVER['PHP_AUTH_USER'];
            $this->password = array_key_exists('PHP_AUTH_PW', $_SERVER) ? $_SERVER['PHP_AUTH_PW'] : null;
        } elseif (array_key_exists('HTTP_AUTHENTICATION', $_SERVER)) { // most other servers
            if (strpos(strtolower($_SERVER['HTTP_AUTHENTICATION']), 'basic') === 0) {
                $userdata = explode(':', base64_decode(substr($_SERVER['HTTP_AUTHENTICATION'], 6)));
                list($this->name, $this->password) = $userdata;
            }
        } elseif (array_key_exists('REDIRECT_HTTP_AUTHORIZATION', $_SERVER)) { // most other servers
            if (strpos(strtolower($_SERVER['REDIRECT_HTTP_AUTHORIZATION']), 'basic') === 0) {
                $userdata = explode(':', base64_decode(substr($_SERVER['REDIRECT_HTTP_AUTHORIZATION'], 6)));
                list($this->name, $this->password) = $userdata;
            }
        }
    }
1364630
public function parseUri()
    {
        $uri = (isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : null);

        if(isset($uri))
        {
            $uri = '/' . ltrim(trim($uri), '/');
            $uri = filter_var($uri, FILTER_SANITIZE_URL);

            return $uri;
        }
        else
        {
            throw new Exception("Error parsing URI please check your URI.", 1);
        }
    }
677578
public function getService()
    {
        if (null === $this->service) {
            $class = explode('\\', get_class($this));
            $class = substr(end($class), 0, -10);
            $serviceKey = strtolower($this->getModuleNamespace() . '_' . $class . '_service');
            $this->setService($this->getServiceLocator()->get($serviceKey));
        }
        return $this->service;
    }
596004
public function parse()
    {

        // load the deployment descriptors that has to be parsed
        $deploymentDescriptors = $this->loadDeploymentDescriptors();

        // parse the deployment descriptors from the conf.d and the application's META-INF directory
        foreach ($deploymentDescriptors as $deploymentDescriptor) {
            // query whether we found epb.xml deployment descriptor file
            if (file_exists($deploymentDescriptor) === false) {
                continue;
            }

            // validate the passed configuration file
            /** @var \AppserverIo\Appserver\Core\Api\ConfigurationService $configurationService */
            $configurationService = $this->getApplication()->newService('AppserverIo\Appserver\Core\Api\ConfigurationService');
            $configurationService->validateFile($deploymentDescriptor, null, true);

            // load the object manager instance
            /** @var \AppserverIo\Psr\Di\ObjectManagerInterface $objectManager */
            $objectManager = $this->getApplication()->search(ObjectManagerInterface::IDENTIFIER);

            // prepare and initialize the configuration node
            $webAppNode = new WebAppNode();
            $webAppNode->initFromFile($deploymentDescriptor);

            /** @var \AppserverIo\Appserver\Core\Api\Node\ServletNode $servletNode */
            foreach ($webAppNode->getServlets() as $servletNode) {
                // iterate over all configured descriptors and try to load object description
                /** \AppserverIo\Appserver\Core\Api\Node\DescriptorNode $descriptor */
                foreach ($this->getDescriptors() as $descriptor) {
                    try {
                        // load the descriptor class
                        $descriptorClass = $descriptor->getNodeValue()->getValue();

                        // load the object descriptor, initialize the servlet mappings and add it to the object manager
                        /** \AppserverIo\Psr\Deployment\DescriptorInterface $objectDescriptor */
                        if ($objectDescriptor = $descriptorClass::newDescriptorInstance()->fromConfiguration($servletNode)) {
                            /** @var \AppserverIo\Appserver\Core\Api\Node\ServletMappingNode $servletMappingNode */
                            foreach ($webAppNode->getServletMappings() as $servletMappingNode) {
                                // query whether or not we've to add the URL pattern for the servlet
                                if ((string) $servletNode->getServletName() === (string) $servletMappingNode->getServletName()) {
                                    $objectDescriptor->addUrlPattern((string) $servletMappingNode->getUrlPattern());
                                }
                            }

                            // add the object descriptor for the servlet
                            $objectManager->addObjectDescriptor($objectDescriptor, true);
                        }

                        // proceed with the next descriptor
                        continue;

                    // if class can not be reflected continue with next class
                    } catch (\Exception $e) {
                        // log an error message
                        $this->getApplication()->getInitialContext()->getSystemLogger()->error($e->__toString());

                        // proceed with the next descriptor
                        continue;
                    }
                }
            }

            // initialize the session configuration if available
            /** @var \AppserverIo\Appserver\Core\Api\Node\SessionConfigNode $sessionConfig */
            if ($sessionConfig = $webAppNode->getSessionConfig()) {
                foreach ($sessionConfig->toArray() as $key => $value) {
                    $this->getManager()->addSessionParameter($key, $value);
                }
            }

            // initialize the error page configuration if available
            /** @var \AppserverIo\Appserver\Core\Api\Node\ErrorPageNode $errorPageNode */
            foreach ($webAppNode->getErrorPages() as $errorPageNode) {
                $this->getManager()->addErrorPage((string) $errorPageNode->getErrorCodePattern(), (string) $errorPageNode->getErrorLocation());
            }

            // initialize the context with the context parameters
            /** @var \AppserverIo\Appserver\Core\Api\Node\ContextParamNode $contextParamNode */
            foreach ($webAppNode->getContextParams() as $contextParamNode) {
                $this->getManager()->addInitParameter((string) $contextParamNode->getParamName(), (string) $contextParamNode->getParamValue());
            }
        }
    }
519539
protected function parse_request(){
		if (isset($_GET['action'])){
			$action = $_GET['action'];
			//simple request mode
			if ($action == "get"){
				//data request
				if (isset($_GET['id'])){
					//single entity data request
					$this->request->set_filter($this->config->id["name"],$_GET['id'],"=");
				} else {
					//loading collection of items
				}
			} else {
				//data saving
				$this->editing = true;
			}
			parent::check_csrf();
		} else {
			if (isset($_GET['editing']) && isset($_POST['ids']))
				$this->editing = true;			
			parent::parse_request();
		}
	
		if (isset($_GET["start"]) && isset($_GET["count"]))
			$this->request->set_limit($_GET["start"],$_GET["count"]);

	}
1323707
protected function _parseCurrentUrl() {
		$prefix = $this->request->param('prefix');
		$plugin = $this->request->param('plugin');
		$controller = $this->request->param('controller');
		$action = $this->request->param('action');
		$named = $this->request->param('named');
		$pass = $this->request->param('pass');
		$named = (!empty($named) ? true : false);
		$pass = (!empty($pass) ? true : false);

		$result = compact(
			'prefix',
			'plugin',
			'controller',
			'action',
			'named',
			'pass'
		);

		return $result;
	}
37680
private function parseRequest($request)
    {
        if (empty($request)) {
            return;
        }

        $this->request = $request;

        // Models used in this request.
        $models_used = [];

        // Review each request.
        foreach ($this->request as $name => $filters) {
            // This name is not present in available attributes.
            if (!Arr::has($this->attributes, $name)) {
                continue;
            }

            // Get the settings for the given attribute.
            $settings = Arr::get($this->attributes, $name);

            // Settings is empty.
            if (empty($settings)) {
                continue;
            }

            // Check and validate each of the filters.
            $filters = self::validateFilters($filters, $settings);

            // Search against current model.
            if (($model_name = Arr::get($settings, 'model_name')) === 'self') {
                $this->search_models['self'][$name] = $filters;
                continue;
            }

            // Search against an model via relationship.
            $models_used[$model_name] = true;
            $this->search_models[$model_name][$name] = $filters;
        }

        // Join the models to this query.
        if (count($models_used)) {
            $this->modelJoin($models_used);
        }
    }
72327
public function parse(Request $request)
    {
        foreach($this->rules as $url => $items)
        {
            $result = $this->checkUrl($request, $url, $params);
            if($result['result'] || $result['resultIgnoreCase'])
            {
                foreach($items as $item)
                {
                    if(
                        ($result['result'] || ($this->ignoreCase || $item['annotation']->ignoreCase)) &&
                        $this->checkMethod($request, $item['annotation']->method) &&
                        $this->checkDomain($request, $item['annotation']->domain, $domainParams) &&
                        $this->checkParamsGet($request, $item['annotation']->paramsGet) &&
                        $this->checkParamsPost($request, $item['annotation']->paramsPost) &&
                        $this->checkHeader($request, $item['annotation']->header) &&
                        $this->checkRequestMime($request, $item['annotation']->requestMime)
                    )
                    {
                        $params = array_merge($params, $domainParams);
                        return [
                            'params'        => $params,
                            'callable'      => $this->parseCallable($params, $item['callable']),
                            'middlewares'   => $item['middlewares'] ?? [],
                            'wsConfig'      => $item['wsConfig'],
                        ];
                    }
                }
            }
        }
        return null;
    }
1056760
public function parse(Request $request)
    {
        if ($request->has($this->name)) {
            $this->applied = true;
            $value         = $request->input($this->name);
            $operation     = substr($value, 0, 1);
            if ($operation === '!') {
                $this->operation = '!=';
                $this->value     = substr($value, 1);
            } else {
                $this->value = $value;
            }
        }
    }
1084124
public function parse_request() {

    $self = $this;

    $request = \Symfony\Component\HttpFoundation\Request::createFromGlobals();
    $dispatcher = \FastRoute\simpleDispatcher(function($r) use ($self) {
      foreach($self->routes as $route) {
        $r->addRoute($route['methods'], $route['route'], $route['callback'], $route['id']);
      }
    }, [
      'routeCollector' => '\Ampersand\\Collector',
    ]);

    // Fetch method and URI from somewhere
    $httpMethod = $_SERVER['REQUEST_METHOD'];
    $uri = $request->getRequestUri();

    // Strip query string (?foo=bar) and decode URI
    if (false !== $pos = strpos($uri, '?')) {
        $uri = substr($uri, 0, $pos);
    }
    $uri = rawurldecode($uri);

    if(strpos($uri, '/wp-admin') > -1) return;

    if($uri == '/404' || $uri == '/404/')
      http_response_code(404);

    $routeInfo = $dispatcher->dispatch($httpMethod, $uri);
    switch ($routeInfo[0]) {
      case \FastRoute\Dispatcher::NOT_FOUND:
        if($uri != '/404' && $uri != '/404/') {
          header("HTTP/1.0 404 Not Found");
          header('Location: '.$this->base.'/404');
          die();
        }
        break;
      case \FastRoute\Dispatcher::METHOD_NOT_ALLOWED:
        $allowedMethods = $routeInfo[1];
        // ... 405 Method Not Allowed
        break;
      case \FastRoute\Dispatcher::FOUND:
        $handler = $routeInfo[1];
        $vars = $routeInfo[2];
        $this->getCallback($handler[1], $handler[0], $vars);
        break;
    }

    Bootstrap::getInstance()->run();
    $this->end();

  }