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


PHP ActionRequest::hasArgument方法代码示例

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


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

示例1: resolveActionMethodName

 /**
  * Determines the action method and assures that the method exists.
  *
  * @return string The action method name
  * @throws \TYPO3\Flow\Mvc\Exception\NoSuchActionException if the action specified in the request object does not exist (and if there's no default action either).
  */
 protected function resolveActionMethodName()
 {
     if ($this->request->getControllerActionName() === 'index') {
         $actionName = 'index';
         switch ($this->request->getHttpRequest()->getMethod()) {
             case 'HEAD':
             case 'GET':
                 $actionName = $this->request->hasArgument($this->resourceArgumentName) ? 'show' : 'list';
                 break;
             case 'POST':
                 $actionName = 'create';
                 break;
             case 'PUT':
                 if (!$this->request->hasArgument($this->resourceArgumentName)) {
                     $this->throwStatus(400, NULL, 'No resource specified');
                 }
                 $actionName = 'update';
                 break;
             case 'DELETE':
                 if (!$this->request->hasArgument($this->resourceArgumentName)) {
                     $this->throwStatus(400, NULL, 'No resource specified');
                 }
                 $actionName = 'delete';
                 break;
         }
         $this->request->setControllerActionName($actionName);
     }
     return parent::resolveActionMethodName();
 }
开发者ID:nlx-sascha,项目名称:flow-development-collection,代码行数:35,代码来源:RestController.php

示例2: getResponse

 /**
  * Returns an Response object containing the OPAuth data
  *
  * @return Response
  */
 public function getResponse()
 {
     if ($this->actionRequest instanceof \TYPO3\Flow\Mvc\ActionRequest && $this->actionRequest->hasArgument('opauth')) {
         $data = $this->actionRequest->getArgument('opauth');
         $response = unserialize(base64_decode($data));
         $this->response = new Response($response);
     }
     return $this->response;
 }
开发者ID:sixty-nine,项目名称:Hfrahmann.Opauth,代码行数:14,代码来源:Opauth.php

示例3: mapRequestArgumentsToControllerArguments

 /**
  * Maps arguments delivered by the request object to the local controller arguments.
  *
  * @return void
  * @throws \TYPO3\Flow\Mvc\Exception\RequiredArgumentMissingException
  * @api
  */
 protected function mapRequestArgumentsToControllerArguments()
 {
     foreach ($this->arguments as $argument) {
         $argumentName = $argument->getName();
         if ($this->request->hasArgument($argumentName)) {
             $argument->setValue($this->request->getArgument($argumentName));
         } elseif ($argument->isRequired()) {
             throw new \TYPO3\Flow\Mvc\Exception\RequiredArgumentMissingException('Required argument "' . $argumentName . '" is not set.', 1298012500);
         }
     }
 }
开发者ID:robertlemke,项目名称:flow-development-collection,代码行数:18,代码来源:AbstractController.php

示例4: updateCredentials

 /**
  * Updates the authentication credentials, the authentication manager needs to authenticate this token.
  * This could be a username/password from a login controller.
  * This method is called while initializing the security context. By returning TRUE you
  * make sure that the authentication manager will (re-)authenticate the tokens with the current credentials.
  * Note: You should not persist the credentials!
  *
  * @param ActionRequest $actionRequest The current request instance
  * @throws \InvalidArgumentException
  * @return boolean TRUE if this token needs to be (re-)authenticated
  */
 public function updateCredentials(ActionRequest $actionRequest)
 {
     if ($actionRequest->getHttpRequest()->getMethod() !== 'GET' || $actionRequest->getInternalArgument('__oauth2Provider') !== $this->authenticationProviderName) {
         return;
     }
     if (!$actionRequest->hasArgument('code')) {
         $this->setAuthenticationStatus(TokenInterface::WRONG_CREDENTIALS);
         $this->securityLogger->log('There was no argument `code` provided.', LOG_NOTICE);
         return;
     }
     $code = $actionRequest->getArgument('code');
     $redirectUri = $this->oauthUriBuilder->getRedirectionEndpointUri($this->authenticationProviderName);
     try {
         $this->credentials['accessToken'] = $this->tokenEndpoint->requestAuthorizationCodeGrantAccessToken($code, $redirectUri);
         $this->setAuthenticationStatus(TokenInterface::AUTHENTICATION_NEEDED);
     } catch (Exception $exception) {
         $this->setAuthenticationStatus(TokenInterface::WRONG_CREDENTIALS);
         $this->securityLogger->logException($exception);
         return;
     }
 }
开发者ID:avency,项目名称:Flowpack.OAuth2.Client,代码行数:32,代码来源:AbstractClientToken.php

示例5: pluginArgumentsAreHandledSeparately

 /**
  * @test
  */
 public function pluginArgumentsAreHandledSeparately()
 {
     $this->actionRequest->setArgument('--typo3-flow-foo-viewhelper-paginate', array('@controller' => 'Foo', 'page' => 5));
     $this->assertFalse($this->actionRequest->hasArgument('--typo3-flow-foo-viewhelper-paginate'));
     $this->assertEquals(array('typo3-flow-foo-viewhelper-paginate' => array('@controller' => 'Foo', 'page' => 5)), $this->actionRequest->getPluginArguments());
 }
开发者ID:kszyma,项目名称:flow-development-collection,代码行数:9,代码来源:ActionRequestTest.php

示例6: pluginArgumentsAreHandledSeparately

 /**
  * @test
  */
 public function pluginArgumentsAreHandledSeparately()
 {
     $httpRequest = HttpRequest::create(new Uri('http://robertlemke.com/blog'));
     $actionRequest = new ActionRequest($httpRequest);
     $actionRequest->setArgument('--typo3-flow-foo-viewhelper-paginate', array('@controller' => 'Foo', 'page' => 5));
     $this->assertFalse($actionRequest->hasArgument('--typo3-flow-foo-viewhelper-paginate'));
     $this->assertEquals(array('typo3-flow-foo-viewhelper-paginate' => array('@controller' => 'Foo', 'page' => 5)), $actionRequest->getPluginArguments());
 }
开发者ID:animaltool,项目名称:webinterface,代码行数:11,代码来源:ActionRequestTest.php


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