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


PHP Assertion::keyExists方法代码示例

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


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

示例1: getKeys

 /**
  * @return \Jose\Object\JWKInterface[]
  */
 public function getKeys()
 {
     $content = json_decode($this->getContent(), true);
     Assertion::isArray($content, 'Invalid content.');
     Assertion::keyExists($content, 'keys', 'Invalid content.');
     return (new JWKSet($content))->getKeys();
 }
开发者ID:spomky-labs,项目名称:jose,代码行数:10,代码来源:JKUJWKSet.php

示例2: checkerParameter

 /**
  * {@inheritdoc}
  */
 public function checkerParameter(ClientInterface $client, array &$parameters)
 {
     /*
      * @see http://tools.ietf.org/html/rfc6749#section-3.1.1
      */
     Assertion::keyExists($parameters, 'response_type', 'The parameter "response_type" is mandatory.');
 }
开发者ID:spomky-labs,项目名称:oauth2-server-library,代码行数:10,代码来源:ResponseTypeParameterChecker.php

示例3: fromArray

 /**
  * @param array $array
  * @return Issuer
  */
 public static function fromArray(array $array)
 {
     Guard::keyExists($array, 'id');
     Guard::keyExists($array, 'name');
     Guard::keyExists($array, 'list_type');
     return new Issuer(SwiftBic::fromString($array['id']), Name::fromString($array['name']), ListType::fromString($array['list_type']));
 }
开发者ID:duronrulez,项目名称:ginger-php,代码行数:11,代码来源:Issuer.php

示例4: reconstituteFromArray

 /**
  * @param array $taskData
  * @return static
  */
 public static function reconstituteFromArray(array $taskData)
 {
     Assertion::keyExists($taskData, 'target_node_name');
     Assertion::keyExists($taskData, 'process_definition');
     Assertion::keyExists($taskData, 'sync_log_messages');
     return new self(NodeName::fromString($taskData['target_node_name']), $taskData['process_definition'], (bool) $taskData['sync_log_messages']);
 }
开发者ID:prooph,项目名称:processing,代码行数:11,代码来源:RunSubProcess.php

示例5: create

 /**
  * @param Request $request
  *
  * @return JsonResponse
  *
  * @throws \Assert\AssertionFailedException
  * @throws InvalidMobileApiException
  * @throws BlankAliasApiException
  * @throws NoTopicsApiException
  * @throws InsufficientBalanceApiException
  * @throws ExistentMobileApiException
  */
 protected function create(Request $request)
 {
     /** @var UsernamePasswordToken $token */
     $token = $this->tokenStorage->getToken();
     $uniqueness = $token->getUsername();
     $data = $request->request->all();
     foreach (array('mobile', 'alias', 'topics') as $key) {
         Assertion::keyExists($data, $key);
     }
     try {
         $this->createSubscriptionApiWorker->create($data['mobile'], $uniqueness, $data['alias'], $data['topics'], $data['resellPackage']);
     } catch (InvalidMobileApiException $e) {
         return new JsonResponse(array('code' => 'INFO_SMS.SUBSCRIPTION.INVALID_MOBILE'), 400);
     } catch (BlankAliasApiException $e) {
         return new JsonResponse(array('code' => 'INFO_SMS.SUBSCRIPTION.BLANK_ALIAS'), 400);
     } catch (ExistentMobileApiException $e) {
         return new JsonResponse(array('code' => 'INFO_SMS.SUBSCRIPTION.EXISTENT_MOBILE'), 400);
     } catch (NoTopicsApiException $e) {
         return new JsonResponse(array('code' => 'INFO_SMS.SUBSCRIPTION.NO_TOPICS'), 400);
     } catch (NoResellPackageApiException $e) {
         return new JsonResponse(array('code' => 'INFO_SMS.SUBSCRIPTION.NO_RESELL_PACKAGE'), 400);
     } catch (TrialNotAcceptedApiException $e) {
         return new JsonResponse(array('code' => 'INFO_SMS.SUBSCRIPTION.TRIAL_NOT_ACCEPTED'), 400);
     } catch (InsufficientBalanceApiException $e) {
         return new JsonResponse(array('code' => 'INFO_SMS.PROFILE.INSUFFICIENT_BALANCE'), 400);
     }
     return new JsonResponse();
 }
开发者ID:nabelhm,项目名称:api,代码行数:40,代码来源:AbstractCreateSubscriptionController.php

示例6: deserialize

 /**
  * @param array $serializedObject
  *
  * @return mixed
  *
  * @throws SerializationException
  */
 public function deserialize(array $serializedObject)
 {
     Assert::keyExists($serializedObject, 'type', "Key 'type' should be set.");
     Assert::keyExists($serializedObject, 'payload', "Key 'payload' should be set.");
     // TODO implement TypeDenormalizer
     return $this->denormalizer->denormalize($serializedObject['payload'], $serializedObject['type'], 'json');
 }
开发者ID:a-mayer,项目名称:boekkooi-broadway,代码行数:14,代码来源:SymfonySerializer.php

示例7: validate

 private function validate()
 {
     Assertion::keyExists($this->options, 'packages');
     Assertion::isArray($this->options['packages']);
     Assertion::keyExists($this->options, 'rooms');
     Assertion::isArray($this->options['rooms']);
 }
开发者ID:alcaeus,项目名称:hipchat-commander,代码行数:7,代码来源:Config.php

示例8: fromArray

 /**
  * Creates a new domain message from given array
  *
  * @param array $messageData
  * @return static
  */
 public static function fromArray(array $messageData)
 {
     Assertion::keyExists($messageData, 'uuid');
     Assertion::keyExists($messageData, 'message_name');
     Assertion::string($messageData['message_name'], 'message name needs to be string');
     Assertion::notEmpty($messageData['message_name'], 'message name must not be empty');
     Assertion::keyExists($messageData, 'version');
     Assertion::integer($messageData['version'], 'version needs to be an integer');
     Assertion::keyExists($messageData, 'payload');
     Assertion::isArray($messageData['payload'], 'payload needs to be an array');
     Assertion::keyExists($messageData, 'metadata');
     Assertion::keyExists($messageData, 'created_at');
     Assertion::isArray($messageData['metadata'], 'metadata needs to be an array');
     $messageRef = new \ReflectionClass(get_called_class());
     /** @var $message DomainMessage */
     $message = $messageRef->newInstanceWithoutConstructor();
     $message->uuid = Uuid::fromString($messageData['uuid']);
     $message->messageName = $messageData['message_name'];
     $message->version = $messageData['version'];
     $message->setPayload($messageData['payload']);
     $message->metadata = $messageData['metadata'];
     if (!$messageData['created_at'] instanceof \DateTimeInterface) {
         $messageData['created_at'] = \DateTimeImmutable::createFromFormat($message->dateTimeFormat, $messageData['created_at'], new \DateTimeZone('UTC'));
     }
     $message->createdAt = $messageData['created_at'];
     return $message;
 }
开发者ID:prolic,项目名称:common,代码行数:33,代码来源:DomainMessage.php

示例9: assertConfig

 private function assertConfig(array $config)
 {
     Assertion::keyExists($config, "dbname");
     Assertion::string($config['dbname']);
     Assertion::keyExists($config, "driver");
     Assertion::inArray($config["driver"], $this->supportedDrivers);
 }
开发者ID:prooph,项目名称:link-sql-connector,代码行数:7,代码来源:DbalConnection.php

示例10: fromArray

 public static function fromArray(array $array)
 {
     Ensure::keyExists($array, 'title');
     Ensure::keyExists($array, 'repositoryName');
     Ensure::keyExists($array, 'url');
     Ensure::keyExists($array, 'loneliness');
     return self::create(Title::fromString($array['title']), RepositoryName::fromString($array['repositoryName']), Url::fromString($array['url']), Loneliness::fromInteger($array['loneliness']));
 }
开发者ID:jeroenvdgulik,项目名称:lonelypullrequests.com,代码行数:8,代码来源:PullRequest.php

示例11: fromJsonDecodedData

 /**
  * @param array $jsonDecodedData
  * @return Payload
  */
 public static function fromJsonDecodedData(array $jsonDecodedData)
 {
     Assertion::keyExists($jsonDecodedData, 'typeClass');
     Assertion::keyExists($jsonDecodedData, 'data');
     Assertion::notEmpty($jsonDecodedData['typeClass']);
     Assertion::string($jsonDecodedData['typeClass']);
     return new static($jsonDecodedData['typeClass'], $jsonDecodedData['data']);
 }
开发者ID:prooph,项目名称:processing,代码行数:12,代码来源:Payload.php

示例12: fromPersistedState

 public static function fromPersistedState(array $state)
 {
     Assertion::keyExists($state, 'account_id');
     Assertion::keyExists($state, 'email');
     Assertion::keyExists($state, 'password');
     Assertion::keyExists($state, 'salt');
     return new AccountCredentials(new AccountId($state['account_id']), new Credentials(new EmailAddress($state['email']), $state['password'], $state['salt']));
 }
开发者ID:gobudgit,项目名称:gobudgit,代码行数:8,代码来源:AccountCredentials.php

示例13: fromArray

 /**
  * @param $array
  *
  * @return Notification
  */
 public static function fromArray($array)
 {
     Ensure::keyExists($array, 'repositoryName');
     Ensure::keyExists($array, 'title');
     Ensure::keyExists($array, 'url');
     Ensure::keyExists($array, 'eventDateTime');
     return new self(RepositoryName::fromString($array['repositoryName']), Title::fromString($array['title']), Url::fromString($array['url']), new DateTimeImmutable($array['eventDateTime']));
 }
开发者ID:jeroenvdgulik,项目名称:lonelypullrequests.com,代码行数:13,代码来源:Notification.php

示例14: __construct

 /**
  * Create a new Currency
  *
  * @param string $name
  */
 private function __construct($name)
 {
     if (!isset(self::$currencies)) {
         self::$currencies = (require __DIR__ . '/currencies.php');
     }
     Assertion::keyExists(self::$currencies, $name);
     $this->name = $name;
 }
开发者ID:philipbrown,项目名称:worldpay,代码行数:13,代码来源:Currency.php

示例15: __invoke

 public function __invoke(ServerRequestInterface $request, ResponseInterface $response)
 {
     $data = $request->getParsedBody();
     Assertion::keyExists($data, 'origin');
     Assertion::keyExists($data, 'destination');
     $trackingId = $this->bookingService->bookNewCargo($data['origin'], $data['destination']);
     return new JsonResponse(['trackingId' => $trackingId]);
 }
开发者ID:josecelano,项目名称:php-ddd-cargo-sample,代码行数:8,代码来源:CreateCargo.php


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