当前位置: 首页>>代码示例>>PHP>>正文


PHP ParameterBag::has方法代码示例

本文整理汇总了PHP中Symfony\Component\HttpFoundation\ParameterBag::has方法的典型用法代码示例。如果您正苦于以下问题:PHP ParameterBag::has方法的具体用法?PHP ParameterBag::has怎么用?PHP ParameterBag::has使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\HttpFoundation\ParameterBag的用法示例。


在下文中一共展示了ParameterBag::has方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: parseTemplateOptions

 /**
  * @param null|string $template
  * @param array       $templateParameters
  *
  * @return array
  */
 private function parseTemplateOptions($template, array $templateParameters)
 {
     if (!array_key_exists('language', $templateParameters) && $this->parameters->has('language')) {
         $templateParameters['language'] = $this->parameters->get('language');
     }
     return ['template' => $template === null ? $this->parameters->get('template') : $template, 'parameters' => new ParameterBag($templateParameters)];
 }
开发者ID:nuxia,项目名称:nuxia-plugin,代码行数:13,代码来源:Mailer.php

示例2: map

 /**
  * @param QueryBuilder $query
  * @param ParameterBag $request
  * @return QueryBuilder
  */
 public function map(QueryBuilder $query, ParameterBag $request)
 {
     if ($request->has('name')) {
         $query->andWhere('o.name LIKE :name')->setParameter('name', '%' . $request->get('name') . '%');
     }
     if ($request->has('login')) {
         $query->andWhere('o.login = :login')->setParameter('login', $request->get('login'));
     }
     return $query;
 }
开发者ID:ChrisdAutume,项目名称:EtuUTT,代码行数:15,代码来源:OrgaListMapper.php

示例3: sendData

 /**
  * Send the request with specified data
  *
  * @param  mixed $data The data to send
  *
  * @return ResponseInterface
  * @throws InvalidRequestException
  */
 public function sendData($data)
 {
     $this->verifySignature();
     if ($this->params->has('notify_id')) {
         if ($this->verifyNotifyId) {
             $this->verifyNotifyId();
         }
     }
     return $this->response = new LegacyNotifyResponse($this, $data);
 }
开发者ID:lokielse,项目名称:omnipay-alipay,代码行数:18,代码来源:LegacyNotifyRequest.php

示例4: retrieveToken

 /**
  * @param OAuth2Provider $provider
  * @param ParameterBag $getParams
  * @return OAuth2Token
  * @throws OAuthException
  */
 protected function retrieveToken(OAuth2Provider $provider, ParameterBag $getParams)
 {
     if ($getParams->has('error')) {
         throw OAuthException::createFromError($getParams->get('error'), $getParams->get('error_description'));
     }
     if (!$getParams->has('code')) {
         throw new GrantCodeNotFoundException('The grant code parameter was not found');
     }
     return $provider->retrieveToken($getParams->get('code'));
 }
开发者ID:lcobucci,项目名称:social,代码行数:16,代码来源:AuthClient.php

示例5: map

 /**
  * @param QueryBuilder $query
  * @param ParameterBag $request
  * @return QueryBuilder
  */
 public function map(QueryBuilder $query, ParameterBag $request)
 {
     if ($request->has('firstname')) {
         $query->andWhere('u.firstName LIKE :firstname')->setParameter('firstname', '%' . $request->get('firstname') . '%');
     }
     if ($request->has('login')) {
         $query->andWhere('u.login = :login')->setParameter('login', $request->get('login'));
     }
     if ($request->has('lastname')) {
         $query->andWhere('u.lastName LIKE :lastname')->setParameter('lastname', '%' . $request->get('lastname') . '%');
     }
     if ($request->has('name')) {
         $term = str_replace(' ', '%', trim($request->get('name')));
         $query->andWhere('u.firstName LIKE :term OR u.lastName LIKE :term OR u.fullName LIKE :term')->setParameter('term', '%' . $term . '%');
     }
     if ($request->has('branch')) {
         $query->andWhere('u.branch = :branch')->setParameter('branch', $request->get('branch'));
     }
     if ($request->has('level')) {
         $query->andWhere('u.niveau = :level')->setParameter('level', $request->get('level'));
     }
     if ($request->has('speciality')) {
         $query->andWhere('u.filiere = :speciality')->setParameter('speciality', $request->get('speciality'));
     }
     if ($request->has('is_student')) {
         $query->andWhere('u.isStudent = :is_student')->setParameter('is_student', (bool) $request->get('is_student'));
     }
     if ($request->has('bde_member') && $request->get('bde_member') == '1') {
         $query->andWhere('m.end > :now')->setParameter('now', new \DateTime('now'));
     }
     return $query;
 }
开发者ID:ChrisdAutume,项目名称:EtuUTT,代码行数:37,代码来源:UserListMapper.php

示例6:

 function it_creates_configuration_from_resource_metadata_and_request(MetadataInterface $metadata, Request $request, ParametersParser $parametersParser, ParameterBag $headersBag, ParameterBag $attributesBag)
 {
     $request->headers = $headersBag;
     $request->attributes = $attributesBag;
     $headersBag->has('Accept')->willReturn(false);
     $headersBag->has('Accept')->willReturn(false);
     $configuration = ['template' => ':Product:show.html.twig'];
     $attributesBag->get('_sylius', [])->shouldBeCalled()->willReturn($configuration);
     $parametersParser->parseRequestValues($configuration, $request)->willReturn($configuration);
     $this->create($metadata, $request)->shouldHaveType(RequestConfiguration::class);
 }
开发者ID:Mozan,项目名称:Sylius,代码行数:11,代码来源:RequestConfigurationFactorySpec.php

示例7:

 function it_can_find_specific_resource_with_slug_by_default(RequestConfiguration $requestConfiguration, Request $request, ParameterBag $requestAttributes, RepositoryInterface $repository, ResourceInterface $resource)
 {
     $requestConfiguration->getRepositoryMethod()->willReturn(null);
     $requestConfiguration->getRequest()->willReturn($request);
     $request->attributes = $requestAttributes;
     $requestAttributes->has('id')->willReturn(false);
     $requestAttributes->has('slug')->willReturn(true);
     $requestAttributes->get('slug')->willReturn('the-most-awesome-hat');
     $repository->findOneBy(array('slug' => 'the-most-awesome-hat'))->willReturn($resource);
     $this->get($requestConfiguration, $repository)->shouldReturn($resource);
 }
开发者ID:Spomky,项目名称:Sylius,代码行数:11,代码来源:SingleResourceProviderSpec.php

示例8: determineAccessTokenInHeader

 /**
  * {@inheritdoc}
  */
 public function determineAccessTokenInHeader(Request $request)
 {
     if ($request->headers->has('Authorization') === false) {
         return;
     }
     $header = $request->headers->get('Authorization');
     if (substr($header, 0, 4) !== 'MAC ') {
         return;
     }
     // Find all the parameters expressed in the header
     $paramsRaw = explode(',', substr($header, 4));
     $params = new ParameterBag();
     array_map(function ($param) use(&$params) {
         $param = trim($param);
         preg_match_all('/([a-zA-Z]*)="([\\w=]*)"/', $param, $matches);
         // @codeCoverageIgnoreStart
         if (count($matches) !== 3) {
             return;
         }
         // @codeCoverageIgnoreEnd
         $key = reset($matches[1]);
         $value = trim(reset($matches[2]));
         if (empty($value)) {
             return;
         }
         $params->set($key, $value);
     }, $paramsRaw);
     // Validate parameters
     if ($params->has('id') === false || $params->has('ts') === false || $params->has('nonce') === false || $params->has('mac') === false) {
         return;
     }
     if ((int) $params->get('ts') !== time()) {
         return;
     }
     $accessToken = $params->get('id');
     $timestamp = (int) $params->get('ts');
     $nonce = $params->get('nonce');
     $signature = $params->get('mac');
     // Try to find the MAC key for the access token
     $macKey = $this->server->getMacStorage()->getByAccessToken($accessToken);
     if ($macKey === null) {
         return;
     }
     // Calculate and compare the signature
     $calculatedSignatureParts = [$timestamp, $nonce, strtoupper($request->getMethod()), $request->getUri(), $request->getHost(), $request->getPort()];
     if ($params->has('ext')) {
         $calculatedSignatureParts[] = $params->get('ext');
     }
     $calculatedSignature = base64_encode(hash_hmac('sha256', implode("\n", $calculatedSignatureParts), $macKey));
     // Return the access token if the signature matches
     return $this->hash_equals($calculatedSignature, $signature) ? $accessToken : null;
 }
开发者ID:leloulight,项目名称:laravel_latest,代码行数:55,代码来源:MAC.php

示例9: parseCookies

 public function parseCookies(ParameterBag $cookies)
 {
     $this->setUtm(new Utm());
     if ($cookies->has('__utmz')) {
         $this->utmz($cookies->get('__utmz'));
     }
     if ($cookies->has('__utmb')) {
         $this->utmb($cookies->get('__utmb'));
     }
     if ($cookies->has('__utma')) {
         $this->utma($cookies->get('__utma'));
     }
     return $this->getUtm();
 }
开发者ID:bco-trey,项目名称:edonate,代码行数:14,代码来源:GoogleCookieParser.php

示例10: prepareRequestUri

    protected function prepareRequestUri()
    {
        $requestUri = '';

        if ($this->headers->has('X_REWRITE_URL')) {
            // check this first so IIS will catch
            $requestUri = $this->headers->get('X_REWRITE_URL');
        } elseif ($this->server->get('IIS_WasUrlRewritten') == '1' && $this->server->get('UNENCODED_URL') != '') {
            // IIS7 with URL Rewrite: make sure we get the unencoded url (double slash problem)
            $requestUri = $this->server->get('UNENCODED_URL');
        } elseif ($this->server->has('REQUEST_URI')) {
            $requestUri = $this->server->get('REQUEST_URI');
            // HTTP proxy reqs setup request uri with scheme and host [and port] + the url path, only use url path
            $schemeAndHttpHost = $this->getScheme().'://'.$this->getHttpHost();
            if (strpos($requestUri, $schemeAndHttpHost) === 0) {
                $requestUri = substr($requestUri, strlen($schemeAndHttpHost));
            }
        } elseif ($this->server->has('ORIG_PATH_INFO')) {
            // IIS 5.0, PHP as CGI
            $requestUri = $this->server->get('ORIG_PATH_INFO');
            if ($this->server->get('QUERY_STRING')) {
                $requestUri .= '?'.$this->server->get('QUERY_STRING');
            }
        }

        return $requestUri;
    }
开发者ID:Gregwar,项目名称:symfony,代码行数:27,代码来源:Request.php

示例11: hasPreviousSession

    /**
     * Whether the request contains a Session which was started in one of the
     * previous requests.
     *
     * @return boolean
     *
     * @api
     */
    public function hasPreviousSession()
    {
        // the check for $this->session avoids malicious users trying to fake a session cookie with proper name
        $sessionName = $this->hasSession() ? $this->session->getName() : null;

        return $this->cookies->has($sessionName) && $this->hasSession();
    }
开发者ID:redpanda,项目名称:symfony,代码行数:15,代码来源:Request.php

示例12: getHelper

 /**
  * Returns helper if it exists or null.
  *
  * @param [type] $method
  *
  * @return AHelper|null
  */
 public function getHelper($method)
 {
     $helper = null;
     if (true === $this->helpers->has($method)) {
         $helper = $this->helpers->get($method);
     }
     return $helper;
 }
开发者ID:mickaelsteinberg,项目名称:BackBee,代码行数:15,代码来源:AbstractRenderer.php

示例13: array

 function it_throws_an_exception_when_a_required_object_is_not_found(FilterControllerEvent $event, Request $request, ParameterBag $attributes)
 {
     $event->getRequest()->willReturn($request);
     $request->attributes = $attributes;
     $attributes->get('_security', array())->willReturn(array(array('roles' => array('IS_OWNER'), 'subject' => 'group')));
     $attributes->has('group')->willReturn(false);
     $this->shouldThrow('RuntimeException')->during('checkIfUserIsGranted', array($event));
 }
开发者ID:knplabs,项目名称:rad-security,代码行数:8,代码来源:AuthorizationListenerSpec.php

示例14: setupQuery

 /**
  * @return $this
  */
 public function setupQuery()
 {
     if (!$this->requestQuery->has('q')) {
         return $this;
     }
     $this->nativeQueryGenerator->setQuery($this->requestQuery->get('q'));
     return $this;
 }
开发者ID:ojs,项目名称:ojs,代码行数:11,代码来源:SearchManager.php

示例15: setHash

 /**
  * Hash the parameters
  * @param ParameterBag $parameters
  */
 public function setHash(ParameterBag &$parameters)
 {
     if ($parameters->has('secret')) {
         $secret = $this->parameters->get('secret');
         $this->parameters->remove('secret');
         $hash = md5(implode('', array_values($this->parameters->all())) . $secret);
         $this->parameters->set('hash', $hash);
     }
 }
开发者ID:lsv,项目名称:omnipay-epay,代码行数:13,代码来源:AbstractRequest.php


注:本文中的Symfony\Component\HttpFoundation\ParameterBag::has方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。