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


PHP Assertion::true方法代碼示例

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


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

示例1: checkerParameter

 /**
  * {@inheritdoc}
  */
 public function checkerParameter(ClientInterface $client, array &$parameters)
 {
     if (false === strpos($parameters['response_type'], 'id_token')) {
         return;
     }
     Assertion::true(array_key_exists('nonce', $parameters), 'The parameter "nonce" is mandatory.');
 }
開發者ID:spomky-labs,項目名稱:oauth2-server-library,代碼行數:10,代碼來源:NonceParameterChecker.php

示例2: checkerParameter

 /**
  * {@inheritdoc}
  */
 public function checkerParameter(ClientInterface $client, array &$parameters)
 {
     if (false === $this->state_parameter_enforced) {
         return;
     }
     Assertion::true(array_key_exists('state', $parameters), 'The parameter "state" is mandatory.');
 }
開發者ID:spomky-labs,項目名稱:oauth2-server-library,代碼行數:10,代碼來源:StateParameterChecker.php

示例3: checkKey

 /**
  * @param JWKInterface $key
  */
 private function checkKey(JWKInterface $key)
 {
     Assertion::eq($key->get('kty'), 'OKP', 'Wrong key type.');
     Assertion::true($key->has('x'), 'The key parameter "x" is missing.');
     Assertion::true($key->has('crv'), 'The key parameter "crv" is missing.');
     Assertion::inArray($key->get('crv'), ['Ed25519'], 'Unsupported curve');
 }
開發者ID:spomky-labs,項目名稱:jose,代碼行數:10,代碼來源:EdDSA.php

示例4: checkerParameter

 /**
  * {@inheritdoc}
  */
 public function checkerParameter(ClientInterface $client, array &$parameters)
 {
     $scope = $this->getScopeManager()->checkScopePolicy($parameters['scope'], $client);
     $available_scope = $this->getScopeManager()->getAvailableScopesForClient($client);
     Assertion::true($this->getScopeManager()->areRequestScopesAvailable($scope, $available_scope), sprintf('An unsupported scope was requested. Available scopes for the client are %s', implode(',', $available_scope)));
     $parameters['scope'] = $scope;
 }
開發者ID:spomky-labs,項目名稱:oauth2-server-library,代碼行數:10,代碼來源:ScopeParameterChecker.php

示例5: unserialize

 /**
  * @param  \stdClass $obj
  * @param  array     $context
  * @return TwitterEvent
  */
 public function unserialize($obj, array $context = [])
 {
     Assertion::true($this->canUnserialize($obj), 'object is not unserializable');
     $createdAt = new \DateTimeImmutable($obj->created_at);
     Assertion::eq(new \DateTimeZone('UTC'), $createdAt->getTimezone());
     return TwitterEvent::create($obj->event, $this->userSerializer->unserialize($obj->source), isset($obj->target) ? $this->userSerializer->unserialize($obj->target) : null, isset($obj->target_object) ? $this->targetSerializer->unserialize($obj->target_object) : null, $createdAt);
 }
開發者ID:remi-san,項目名稱:twitter,代碼行數:12,代碼來源:TwitterEventSerializer.php

示例6: fromString

 /**
  * Initializes and returns a coordinate object with the specified coordinate information in string format.
  *
  * Valid format:
  * "latitude in degrees, longitude in degrees"
  *
  * Example:
  * "51.3703748, 6.1724031"
  *
  * Please note that UTM and MGRS coordinates are not yet supported!
  *
  * @param $coordinate Coordinate information in string format
  *
  * @return static
  */
 public static function fromString($coordinate)
 {
     Assertion::string($coordinate);
     Assertion::true(substr_count($coordinate, ',') === 1);
     $coordinate = explode(',', $coordinate);
     return new static((double) $coordinate[0], (double) $coordinate[1]);
 }
開發者ID:patrickkempff,項目名稱:location,代碼行數:22,代碼來源:Coordinate2d.php

示例7: checkerParameter

 /**
  * {@inheritdoc}
  */
 public function checkerParameter(ClientInterface $client, array &$parameters)
 {
     if (false === array_key_exists('response_mode', $parameters)) {
         return;
     }
     Assertion::true($this->isResponseModeParameterInAuthorizationRequestAllowed(), 'The parameter "response_mode" is not allowed.');
 }
開發者ID:spomky-labs,項目名稱:oauth2-server-library,代碼行數:10,代碼來源:ResponseModeParameterChecker.php

示例8: addOptions

 private function addOptions(DOMDocument $document, DOMNode $node, array $options, array $selectedValues)
 {
     foreach ($options as $value => $label) {
         if (is_int($value)) {
             $value = (string) $value;
         } else {
             Assertion::string($value);
         }
         Assertion::true(is_string($label) || is_array($label));
         if (is_array($label)) {
             $optgroup = $document->createElement('optgroup');
             $this->addAttributes($optgroup, ['label' => $value]);
             $this->addOptions($document, $optgroup, $label, $selectedValues);
             $node->appendChild($optgroup);
             continue;
         }
         $option = $document->createElement('option');
         $option->appendChild($document->createTextNode($label));
         $htmlAttributes = ['value' => $value];
         if (in_array($value, $selectedValues)) {
             $htmlAttributes['selected'] = 'selected';
         }
         $this->addAttributes($option, $htmlAttributes);
         $node->appendChild($option);
     }
 }
開發者ID:dasprid,項目名稱:formidable,代碼行數:26,代碼來源:Select.php

示例9: unserialize

 /**
  * @param  \stdClass $obj
  * @param  array     $context
  * @return \Twitter\Object\Tweet
  */
 public function unserialize($obj, array $context = [])
 {
     Assertion::true($this->canUnserialize($obj), 'object is not unserializable');
     $createdAt = new \DateTimeImmutable($obj->created_at);
     Assertion::eq(new \DateTimeZone('UTC'), $createdAt->getTimezone());
     return Tweet::create(TwitterMessageId::create($obj->id), $this->userSerializer->unserialize($obj->user), $obj->text, $obj->lang, $createdAt, $obj->entities ? $this->twitterEntitiesSerializer->unserialize($obj->entities) : TwitterEntities::create(), $obj->coordinates ? $this->coordinatesSerializer->unserialize($obj->coordinates) : null, $obj->place ? $this->placeSerializer->unserialize($obj->place) : null, $obj->in_reply_to_status_id, $obj->in_reply_to_user_id, $obj->in_reply_to_screen_name, $obj->retweeted, $obj->retweet_count, $obj->favorited, $obj->favorite_count, $obj->truncated, $obj->source, isset($obj->retweeted_status) ? $this->unserialize($obj->retweeted_status) : null);
 }
開發者ID:remi-san,項目名稱:twitter,代碼行數:12,代碼來源:TweetSerializer.php

示例10: checkPKCEInput

 /**
  * {@inheritdoc}
  */
 public function checkPKCEInput($code_challenge_method, $code_challenge, $code_verifier)
 {
     Assertion::true($this->hasPKCEMethod($code_challenge_method), sprintf('Unsupported code challenge method "%s".', $code_challenge_method));
     $method = $this->getPKCEMethod($code_challenge_method);
     Assertion::notNull($code_verifier, 'The parameter "code_verifier" is required.');
     Assertion::true($method->isChallengeVerified($code_verifier, $code_challenge), 'Invalid parameter "code_verifier".');
 }
開發者ID:spomky-labs,項目名稱:oauth2-server-library,代碼行數:10,代碼來源:PKCEMethodManager.php

示例11: checkerParameter

 /**
  * {@inheritdoc}
  */
 public function checkerParameter(ClientInterface $client, array &$parameters)
 {
     if (!array_key_exists('display', $parameters)) {
         return;
     }
     Assertion::true(in_array($parameters['display'], $this->getAllowedDisplayValues()), sprintf('Invalid parameter "display". Allowed values are %s', json_encode($this->getAllowedDisplayValues())));
 }
開發者ID:spomky-labs,項目名稱:oauth2-server-library,代碼行數:10,代碼來源:DisplayParameterChecker.php

示例12: getKey

 /**
  * @param int $index
  *
  * @return \Jose\Object\JWKInterface
  */
 public function getKey($index)
 {
     Assertion::integer($index, 'The index must be a positive integer.');
     Assertion::greaterOrEqualThan($index, 0, 'The index must be a positive integer.');
     Assertion::true($this->hasKey($index), 'Undefined index.');
     return $this->getKeys()[$index];
 }
開發者ID:spomky-labs,項目名稱:jose,代碼行數:12,代碼來源:BaseJWKSet.php

示例13: serialize

 /**
  * @param  TwitterSerializable $object
  * @return \stdClass
  */
 public function serialize(TwitterSerializable $object)
 {
     Assertion::true($this->canSerialize($object), 'object must be an instance of TwitterEventTarget');
     if ($object instanceof Tweet) {
         return $this->tweetSerializer->serialize($object);
     }
     throw new \BadMethodCallException('Not Implemented');
 }
開發者ID:remi-san,項目名稱:twitter,代碼行數:12,代碼來源:TwitterEventTargetSerializer.php

示例14: encrypt

 /**
  * {@inheritdoc}
  */
 public function encrypt($payload, array $encryption_protected_headers, Object\JWKInterface $encryption_key)
 {
     Assertion::true($this->isEncryptionSupportEnabled(), 'The encryption support is not enabled');
     $jwe = Factory\JWEFactory::createJWE($payload, $encryption_protected_headers);
     $jwe = $jwe->addRecipientInformation($encryption_key);
     $this->encrypter->encrypt($jwe);
     return $jwe->toCompactJSON(0);
 }
開發者ID:spomky-labs,項目名稱:jose,代碼行數:11,代碼來源:JWTCreator.php

示例15: checkerParameter

 /**
  * {@inheritdoc}
  */
 public function checkerParameter(ClientInterface $client, array &$parameters)
 {
     if (!array_key_exists('prompt', $parameters)) {
         return;
     }
     Assertion::true(empty(array_diff($parameters['prompt'], $this->getAllowedPromptValues())), sprintf('Invalid parameter "prompt". Allowed values are %s', json_encode($this->getAllowedPromptValues())));
     Assertion::false(in_array('none', $parameters['prompt']) && 1 !== count($parameters['prompt']), 'Invalid parameter "prompt". Prompt value "none" must be used alone.');
 }
開發者ID:spomky-labs,項目名稱:oauth2-server-library,代碼行數:11,代碼來源:PromptParameterChecker.php


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