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


PHP Assertion::notEmptyKey方法代碼示例

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


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

示例1: join

 /**
  * {@inheritdoc}
  */
 public function join(string $channel, array $data = [])
 {
     Assertion::notEmptyKey($data, 'socketId', "Invalid socket id");
     Assertion::notEmptyKey($data, 'userId', "Invalid user id");
     Assertion::notEmptyKey($data, 'fullName', "Invalid full name");
     return $this->pusher->presence_auth($channel, $data['socketId'], $data['userId'], ['id' => $data['userId'], 'name' => utf8_encode($data['fullName'])]);
 }
開發者ID:domynation,項目名稱:domynation-framework,代碼行數:10,代碼來源:PusherWebSocket.php

示例2: __call

 /**
  * Returns dynamic properties passed to the object
  *
  * Notice: property names should be camelCased
  *
  * @param string $method
  * @param array  $arguments
  *
  * @return mixed
  *
  * @throws BadMethodCallException If $method is not a property
  */
 public function __call($method, array $arguments)
 {
     if (substr($method, 0, 3) === 'get' and $property = substr($method, 3)) {
         $property = lcfirst($property);
         Assertion::notEmptyKey($this->data, $property, 'User does not have a(n) "%s" property');
         return $this->data[$property];
     }
     throw new \BadMethodCallException(sprintf('Method "%s" does not exists', $method));
 }
開發者ID:indigophp,項目名稱:guardian,代碼行數:21,代碼來源:Simple.php

示例3: identify

 /**
  * {@inheritdoc}
  */
 public function identify(array $subject)
 {
     Assertion::notEmptyKey($subject, 'username');
     if (!in_array($subject['username'], $this->userKeys)) {
         throw new IdentificationFailed('User not found');
     }
     $id = array_search($subject['username'], $this->userKeys);
     return new SimpleUser($id, $this->users[$id]);
 }
開發者ID:indigophp,項目名稱:guardian,代碼行數:12,代碼來源:InMemory.php

示例4: __construct

 /**
  * @param array $configuration Array with configuration settings
  * @throws InvalidArgumentException
  */
 public function __construct(array $configuration)
 {
     // Validate and set base url
     Assertion::notEmptyKey($configuration, 'apiBaseUrl', 'apiBaseUrl is required');
     Assertion::url($configuration['apiBaseUrl'], 'apiBaseUrl has to be a valid url');
     $this->apiBaseUrl = rtrim($configuration['apiBaseUrl'], '/');
     // Validate username
     Assertion::notEmptyKey($configuration, 'username', 'username is required');
     Assertion::string($configuration['username'], 'username has to be a string');
     $this->username = trim($configuration['username']);
     // Validate api interface id
     Assertion::notEmptyKey($configuration, 'apiId', 'apiId is required');
     Assertion::integer($configuration['apiId'], 'apiId has to be an integer');
     $this->apiId = trim($configuration['apiId']);
     // Validate api key
     Assertion::notEmptyKey($configuration, 'apiKey', 'apiKey is required');
     Assertion::string($configuration['apiKey'], 'apiKey has to be a string');
     $this->apiKey = trim($configuration['apiKey']);
     // Check if clientConfiguration is set and valid
     if (isset($configuration['clientConfiguration'])) {
         Assertion::isArray($configuration['clientConfiguration'], 'clientConfiguration has to be an array');
         $this->clientConfiguration = $configuration['clientConfiguration'];
     }
 }
開發者ID:simplyadmire,項目名稱:zaaksysteem,代碼行數:28,代碼來源:Configuration.php

示例5: testInvalidNotEmptyKey

 /**
  * @dataProvider invalidNotEmptyKeyDataprovider
  */
 public function testInvalidNotEmptyKey($invalidArray, $key)
 {
     $this->setExpectedException('Assert\\InvalidArgumentException');
     Assertion::notEmptyKey($invalidArray, $key);
 }
開發者ID:GerDner,項目名稱:luck-docker,代碼行數:8,代碼來源:AssertTest.php

示例6: createResult

 private function createResult(array $result_data)
 {
     Assertion::notEmptyKey($result_data, self::OBJECT_TYPE);
     return $this->projection_type_map->getItem($result_data[self::OBJECT_TYPE])->createEntity($result_data);
 }
開發者ID:honeybee,項目名稱:honeybee,代碼行數:5,代碼來源:ProjectionReader.php

示例7: detachSubject

 /**
  * Unregisters a subject from a specific event.
  *
  * @param string $event
  * @param string $key
  */
 public function detachSubject($event, $key)
 {
     Assertion::notEmptyKey($this->subjects, $event, 'Provided event does not exist.');
     Assertion::notEmptyKey($this->subjects[$event], $key, 'Subject to be detached does not exist.');
     unset($this->subjects[$event][$key]);
 }
開發者ID:liip,項目名稱:dataaggregator,代碼行數:12,代碼來源:SubjectDispatcher.php


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