当前位置: 首页>>代码示例>>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;未经允许,请勿转载。