當前位置: 首頁>>代碼示例>>PHP>>正文


PHP RouteMatch::getParam方法代碼示例

本文整理匯總了PHP中Zend\Mvc\Router\RouteMatch::getParam方法的典型用法代碼示例。如果您正苦於以下問題:PHP RouteMatch::getParam方法的具體用法?PHP RouteMatch::getParam怎麽用?PHP RouteMatch::getParam使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend\Mvc\Router\RouteMatch的用法示例。


在下文中一共展示了RouteMatch::getParam方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getVersionFromRouteMatch

 /**
  * Retrieve the version from the route match.
  *
  * The route prototype sets "version", while the Content-Type listener sets
  * "zf_ver_version"; check both to obtain the version, giving priority to the
  * route prototype result.
  *
  * @param  RouteMatch $routeMatches
  * @return int|false
  */
 protected function getVersionFromRouteMatch(RouteMatch $routeMatches)
 {
     $version = $routeMatches->getParam('zf_ver_version', false);
     if ($version) {
         return $version;
     }
     return $routeMatches->getParam('version', false);
 }
開發者ID:gstearmit,項目名稱:EshopVegeTable,代碼行數:18,代碼來源:VersionListener.php

示例2: getResponse

 public function getResponse()
 {
     $response = $this->siteAccess->dispatch($this->routeMatch->getParam('path'))->getResponse();
     // Calc total run time
     $this->getServiceLocator()->get('accumulator')->start('Total', SCRIPT_START);
     $this->getServiceLocator()->get('accumulator')->stop('Total');
     $this->getServiceLocator()->get('accumulator')->memory_usage('Before sending response');
     $this->addDebugOutput($response);
     return $response;
 }
開發者ID:pkamps,項目名稱:basexms,代碼行數:10,代碼來源:Application.php

示例3: getAllowedRoles

 protected function getAllowedRoles(RouteMatch $routeMatch)
 {
     $controller = strtolower($routeMatch->getParam('controller'));
     $action = strtolower($routeMatch->getParam('action'));
     $restAction = strtolower($routeMatch->getParam('restAction'));
     $rolesByAction = @$this->rules[$controller] ?: [];
     $roles = @$rolesByAction[$action] ?: @$rolesByAction[$restAction];
     $roles = $roles ?: @$rolesByAction['*'];
     return $roles;
 }
開發者ID:aerisweather,項目名稱:ZfAuth,代碼行數:10,代碼來源:ControllerGuard.php

示例4: resolveController

 public static function resolveController(RouteMatch $routeMatch)
 {
     if (($extension = $routeMatch->getParam('extension')) && ($manifestName = $routeMatch->getParam('manifestName'))) {
         if ($endpoint = $routeMatch->getParam('endpoint')) {
             $routeMatch->setParam('controller', implode('.', [$extension, $manifestName, $endpoint]));
         } else {
             $routeMatch->setParam('controller', implode('.', [$extension, $manifestName]));
         }
     }
 }
開發者ID:superdweebie,項目名稱:doctrine-extensions-module,代碼行數:10,代碼來源:RouteListener.php

示例5: injectRouteMatches

 /**
  * Inject regex matches into the route matches
  *
  * @param  RouteMatch $routeMatches
  */
 protected function injectRouteMatches(RouteMatch $routeMatches, $matches)
 {
     if (!class_exists('\\ZF\\Apigility\\Admin\\Module', false)) {
         $vendor = $matches['zf_ver_vendor'];
         $version = $matches['zf_ver_version'];
         $controllerTest = $vendor . '\\V' . $version;
         if (strpos($routeMatches->getParam('controller'), $controllerTest) !== 0) {
             $controllerParts = explode('\\', $routeMatches->getParam('controller'));
             $controllerParts[0] = $vendor;
             $controllerParts[1] = 'V' . $version;
             $controller = implode('\\', $controllerParts);
             $routeMatches->setParam('controller', $controller);
         }
     }
 }
開發者ID:zpetr,項目名稱:apigility-routeaccept,代碼行數:20,代碼來源:RouteAcceptListener.php

示例6: prepareSubResource

 /**
  * Prepares the REST Request object with values appropriate for a sub-resource request.
  *
  * @param \BedRest\Rest\Request\Request $restRequest
  * @param \Zend\Http\Request            $httpRequest
  * @param \Zend\Mvc\Router\RouteMatch   $routeMatch
  */
 protected function prepareSubResource(RestRequest $restRequest, HttpRequest $httpRequest, RouteMatch $routeMatch)
 {
     $id = $routeMatch->getParam('id', null);
     $restRequest->setParameter('identifier', $id);
     $resourceName = $routeMatch->getParam('__CONTROLLER__');
     $subResourceName = $routeMatch->getParam('subresource', null);
     $restRequest->setResource($resourceName . '/' . $subResourceName);
     $subId = $routeMatch->getParam('subresource_id', null);
     if (!empty($subId)) {
         $restRequest->setParameter('subresource_identifier', $subId);
     }
     $method = strtoupper($httpRequest->getMethod());
     if (!empty($method)) {
         if (empty($subId) && $method !== RestRequestType::METHOD_POST) {
             $method .= '_COLLECTION';
         }
         $restRequest->setMethod(constant('BedRest\\Rest\\Request\\Type::METHOD_' . $method));
     }
 }
開發者ID:bedrest,項目名稱:framework-zendframework2,代碼行數:26,代碼來源:RequestFactory.php

示例7: resolveController

 public static function resolveController(RouteMatch $routeMatch)
 {
     if ($routeMatch->getMatchedRouteName() != 'rest') {
         return;
     }
     if ($endpoint = $routeMatch->getParam('endpoint')) {
         $routeMatch->setParam('controller', 'shard.rest.' . $endpoint);
     } else {
         $routeMatch->setParam('controller', 'shard.rest');
     }
 }
開發者ID:zoopcommerce,項目名稱:shard-module,代碼行數:11,代碼來源:RouteListener.php

示例8: setRouteVariables

 protected function setRouteVariables(RouteMatch $routeMatch)
 {
     $controller = $routeMatch->getParam('controller');
     $controller = strtolower(substr($controller, strrpos($controller, '\\') + 1));
     $action = $routeMatch->getParam('action');
     $route = $routeMatch->getMatchedRouteName();
     $setArray = ['route' => $route, 'controller' => $controller, 'action' => $action];
     $alias = $routeMatch->getParam('alias');
     if ($alias) {
         $setArray['alias'] = $alias;
     }
     $id = $routeMatch->getParam('id');
     if ($id) {
         $setArray['id'] = $id;
     }
     $page = $routeMatch->getParam('page');
     if ($page) {
         $setArray['page'] = $page;
     }
     return $setArray;
 }
開發者ID:veniva,項目名稱:zcms,代碼行數:21,代碼來源:Module.php

示例9: getModelResource

 /**
  * Create the modelResource that will be used in ACL checks
  * @param \Zend\Mvc\Router\RouteMatch $routeMatch
  * @param Request $request
  * @param type $resourceString
  * @return \Application\Authorization\ModelResource
  */
 private function getModelResource(\Zend\Mvc\Router\RouteMatch $routeMatch, Request $request, $resourceString)
 {
     $controller = $routeMatch->getParam('controller', false);
     $identifierName = $this->restControllers[$controller];
     $id = $this->getIdentifier($identifierName, $routeMatch, $request);
     $model = $this->config['zf-rest'][$controller]['entity_class'];
     // If we are trying to create a new relation object, then we need to get ACL
     // from the pre-existing objects in DB, so we adapt a few things
     if (array_key_exists($resourceString, $this->mapping)) {
         $mapping = $this->mapping[$resourceString];
         $model = $mapping['model'];
         $id = $this->getId($request, $mapping['id']);
     }
     return new ModelResource($resourceString, $model, $id);
 }
開發者ID:Theodia,項目名稱:theodia.org,代碼行數:22,代碼來源:ResourceResolverListener.php

示例10: staticGetParam

 /**
  * Mimics zf1 Request::getParam behavior
  *
  * Route match -> GET -> POST
  */
 public static function staticGetParam(RouteMatch $routeMatch, Request $request, $param = null, $default = null)
 {
     if ($param === null) {
         $params = (array) $routeMatch->getParams();
         if ($request instanceof ConsoleRequest) {
             return $params + (array) $request->getParams();
         }
         return $params + $request->getQuery()->toArray() + $request->getPost()->toArray();
     }
     if ($request instanceof ConsoleRequest) {
         $default = $request->getParam($param, $default);
     } else {
         $default = $request->getQuery($param, $request->getPost($param, $default));
     }
     return $routeMatch->getParam($param, $default);
 }
開發者ID:grizzm0,項目名稱:zf2-for-1,代碼行數:21,代碼來源:LegacyParams.php

示例11: checkParams

 /**
  * Check if we should cache the request based on the params in the routematch
  *
  * @param  RouteMatch $match
  * @param  array      $routeConfig
  * @return bool
  */
 protected function checkParams(RouteMatch $match, $routeConfig)
 {
     if (!isset($routeConfig['params'])) {
         return true;
     }
     $params = (array) $routeConfig['params'];
     foreach ($params as $name => $value) {
         $param = $match->getParam($name, null);
         if (null === $param) {
             continue;
         }
         if (!$this->checkParam($param, $value)) {
             return false;
         }
     }
     return true;
 }
開發者ID:stefanorg,項目名稱:zf2-fullpage-cache,代碼行數:24,代碼來源:Route.php

示例12: getIdentifier

 /**
  * Retrieve the identifier, if any
  *
  * Attempts to see if an identifier was passed in either the URI or the
  * query string, returning if if found. Otherwise, returns a boolean false.
  *
  * @param  \Zend\Mvc\Router\RouteMatch $routeMatch
  * @param  Request $request
  * @return false|mixed
  */
 protected function getIdentifier($routeMatch, $request)
 {
     $id = $routeMatch->getParam('id', false);
     if ($id) {
         return $id;
     }
     $id = $request->getQuery()->get('id', false);
     if ($id) {
         return $id;
     }
     return false;
 }
開發者ID:razvansividra,項目名稱:pnlzf2-1,代碼行數:22,代碼來源:AbstractRestfulController.php

示例13: forgetSavedDestinationWhenNotAuthenticating

 /**
  * this is a weird one
  *
  * i noticed a use case during testing where if an unauthenticated user attempts
  * to navigate to a protected route and the destination is saved,
  * they could click on anything else an avoid the authentication process
  * and since the saved destination information is never consumed, it persists
  * and if that user does authenitcate later, it will send them to that
  * initial route whether they had requested it or not
  *
  * this removes that saved information as soon as the user selects a route that does
  * not have the same controller that is used to
  * @param RouteMatch $routeMatch
  */
 private function forgetSavedDestinationWhenNotAuthenticating(RouteMatch $routeMatch)
 {
     /*
      * run dependency check
      */
     $this->checkDependencies();
     $routeForwardingContainer = $this->routeForwardingContainer;
     $controller = $routeMatch->getParam('controller');
     if ($controller != self::UNAUTHENTICATED_CONTROLLER) {
         $routeForwardingContainer->offsetUnset(self::ROUTE_FORWARDING_SESSION_KEY);
     }
 }
開發者ID:decmade,項目名稱:zendAbacAcl,代碼行數:26,代碼來源:UserAttributeEvaluatorListener.php

示例14: getIdentifier

 protected function getIdentifier(RouteMatch $routeMatch, RequestInterface $request)
 {
     $identifier = $this->getIdentifierName();
     $id = $routeMatch->getParam($identifier, false);
     if ($id !== false) {
         return $id;
     }
     if ($request instanceof Request) {
         $id = $request->getQuery()->get($identifier, false);
         if ($id !== false) {
             return $id;
         }
     }
     return false;
 }
開發者ID:nobesnickr,項目名稱:ApiTimesheets,代碼行數:15,代碼來源:EntityManagementController.php

示例15: getKey

 /**
  * @param RouteMatch $routeMatch
  * @return string
  */
 public static function getKey(RouteMatch $routeMatch)
 {
     return $routeMatch->getParam('controller') . self::KEY_SEPARATOR . $routeMatch->getParam('action');
 }
開發者ID:nbochenko,項目名稱:cache,代碼行數:8,代碼來源:CacheStrategy.php


注:本文中的Zend\Mvc\Router\RouteMatch::getParam方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。