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


PHP Assertion::isArray方法代碼示例

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


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

示例1: guardRequiredState

 protected function guardRequiredState()
 {
     parent::guardRequiredState();
     Assertion::regex($this->projection_type, '#^([a-z][a-z_-]+(?<!_-)\\.){2}[a-z][a-z_]+(?<!_)::projection\\.[a-z][a-z_]+(?<!_)$#');
     Assertion::isArray($this->data);
     Assertion::regex($this->projection_identifier, '/[\\w\\.\\-_]{1,128}\\-\\w{8}\\-\\w{4}\\-\\w{4}\\-\\w{4}\\-\\w{12}\\-\\w{2}_\\w{2}\\-\\d+/');
 }
開發者ID:honeybee,項目名稱:honeybee,代碼行數:7,代碼來源:ProjectionEvent.php

示例2: authenticate

 /**
  * {@inheritdoc}
  */
 public function authenticate($subject, Caller $caller)
 {
     Assertion::isArray($subject);
     Assertion::choicesNotEmpty($subject, ['password']);
     Assertion::isInstanceOf($caller, 'Guardian\\User\\Caller', sprintf('The caller was expected to be an instance of "%s"', 'Indigo\\Guardian\\Caller\\User'));
     return $this->hasher->verify($subject['password'], $caller->getPassword());
 }
開發者ID:guardianphp,項目名稱:user,代碼行數:10,代碼來源:UserPassword.php

示例3: 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

示例4: 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

示例5: deserialize

 public static function deserialize($data)
 {
     Assertion::isArray($data);
     $entities = array_map(function ($entity) {
         return Entity::deserialize($entity);
     }, $data);
     return new self($entities);
 }
開發者ID:OpenConext,項目名稱:SamlValueObject,代碼行數:8,代碼來源:EntitySet.php

示例6: __construct

 /**
  * Create a new value object
  * @param array $value
  */
 public function __construct($value)
 {
     Assertion::isArray($value);
     foreach ($value as $object) {
         Assertion::implementsInterface($object, EventInterface::class);
     }
     $this->value = SplFixedArray::fromArray($value);
 }
開發者ID:phparmory,項目名稱:rate,代碼行數:12,代碼來源:EventCollection.php

示例7: extractWithMetadata

 private function extractWithMetadata($entity, Entity $metadata) : array
 {
     if ($entity instanceof ProxyInterface) {
         $entity = $entity->__getRealEntity();
     }
     Assertion::isInstanceOf($entity, $metadata->getClassName());
     $data = [];
     $reflectionClass = new ReflectionClass($entity);
     foreach ($metadata->getFields() as $fieldMetadata) {
         if ($fieldMetadata->isReadOnly()) {
             continue;
         }
         $fieldName = $fieldMetadata->getFieldName();
         try {
             $type = $fieldMetadata->getType();
             $value = $this->getProperty($reflectionClass, $entity, $fieldMetadata->getPropertyName());
             if (!$fieldMetadata->isRepeatable()) {
                 $data[$fieldName] = $type->toFileMakerValue($value);
                 continue;
             }
             Assertion::isArray($value);
             $index = 0;
             foreach ($value as $individualValue) {
                 $data[sprintf('%s(%d)', $fieldName, ++$index)] = $type->toFileMakerValue($individualValue);
             }
         } catch (Exception $e) {
             throw ExtractionException::fromInvalidField($metadata, $fieldMetadata, $e);
         }
     }
     foreach ($metadata->getEmbeddables() as $embeddableMetadata) {
         $prefix = $embeddableMetadata->getFieldNamePrefix();
         $embeddableData = $this->extractWithMetadata($this->getProperty($reflectionClass, $entity, $embeddableMetadata->getPropertyName()), $embeddableMetadata->getMetadata());
         foreach ($embeddableData as $key => $value) {
             $data[$prefix . $key] = $value;
         }
     }
     $toOne = array_filter($metadata->getManyToOne(), function (ManyToOne $manyToOneMetadata) {
         return !$manyToOneMetadata->isReadOnly();
     }) + array_filter($metadata->getOneToOne(), function (OneToOne $oneToOneMetadata) {
         return $oneToOneMetadata->isOwningSide() && !$oneToOneMetadata->isReadOnly();
     });
     foreach ($toOne as $relationMetadata) {
         $relation = $this->getProperty($reflectionClass, $entity, $relationMetadata->getPropertyName());
         if (null === $relation) {
             $data[$relationMetadata->getFieldName()] = null;
             continue;
         }
         if ($relation instanceof ProxyInterface) {
             Assertion::isInstanceOf($relation->__getRealEntity(), $relationMetadata->getTargetEntity());
             $relationId = $relation->__getRelationId();
         } else {
             Assertion::isInstanceOf($relation, $relationMetadata->getTargetEntity());
             $relationId = $this->getProperty(new ReflectionClass($relation), $relation, $relationMetadata->getTargetPropertyName());
         }
         $data[$relationMetadata->getFieldName()] = $relationId;
     }
     return $data;
 }
開發者ID:soliantconsulting,項目名稱:simplefm,代碼行數:58,代碼來源:MetadataExtraction.php

示例8: check

 /**
  * {@inheritdoc}
  */
 public function check(ClientInterface $client, array $registration_parameters)
 {
     if (!array_key_exists('request_uris', $registration_parameters)) {
         return;
     }
     Assertion::isArray($registration_parameters['request_uris'], 'The parameter "request_uris" must be a list of URI.');
     Assertion::allUrl($registration_parameters['request_uris'], 'The parameter "request_uris" must be a list of URI.');
     $client->set('request_uris', $registration_parameters['request_uris']);
 }
開發者ID:spomky-labs,項目名稱:oauth2-server-library,代碼行數:12,代碼來源:RequestUriRule.php

示例9: __construct

 /**
  * Create a new immutable Body instance
  *
  * @param string $route
  * @param string $signature
  * @param array $data
  * @return void
  */
 public function __construct($route, $signature, $data)
 {
     Assertion::url($route);
     Assertion::string($signature);
     Assertion::isArray($data);
     $this->route = $route;
     $this->signature = $signature;
     $this->data = $data;
 }
開發者ID:philipbrown,項目名稱:worldpay,代碼行數:17,代碼來源:Body.php

示例10: loadFromProvisioningUri

 /**
  * @param string $uri
  *
  * @throws \InvalidArgumentException
  *
  * @return \OTPHP\TOTP|\OTPHP\HOTP
  */
 public static function loadFromProvisioningUri($uri)
 {
     $parsed_url = parse_url($uri);
     Assertion::isArray($parsed_url, 'Not a valid OTP provisioning URI');
     self::checkData($parsed_url);
     $otp = self::createOTP($parsed_url);
     self::populateOTP($otp, $parsed_url);
     return $otp;
 }
開發者ID:spomky-labs,項目名稱:otphp,代碼行數:16,代碼來源:Factory.php

示例11: reconstituteFromArray

 /**
  * @param array $taskData
  * @return static
  */
 public static function reconstituteFromArray(array $taskData)
 {
     Assertion::keyExists($taskData, 'target');
     Assertion::keyExists($taskData, 'allowed_types');
     Assertion::keyExists($taskData, 'preferred_type');
     Assertion::keyExists($taskData, 'metadata');
     Assertion::isArray($taskData['allowed_types']);
     return new self($taskData['target'], $taskData['allowed_types'], $taskData['preferred_type'], $taskData['metadata']);
 }
開發者ID:prooph,項目名稱:processing,代碼行數:13,代碼來源:ProcessData.php

示例12: guardRequiredState

 protected function guardRequiredState()
 {
     parent::guardRequiredState();
     Assertion::string($this->parent_attribute_name);
     Assertion::string($this->embedded_entity_type);
     Assertion::uuid($this->embedded_entity_identifier);
     Assertion::isArray($this->embedded_entity_events);
     Assertion::isArray($this->data);
 }
開發者ID:honeybee,項目名稱:honeybee,代碼行數:9,代碼來源:EmbeddedEntityEvent.php

示例13: checkHeader

 /**
  * {@inheritdoc}
  */
 public function checkHeader(array $protected_headers, array $headers, array $checked_claims)
 {
     if (!array_key_exists('crit', $protected_headers)) {
         return;
     }
     Assertion::isArray($protected_headers['crit'], 'The parameter "crit" must be a list.');
     $diff = array_diff($protected_headers['crit'], $checked_claims);
     Assertion::true(empty($diff), sprintf('One or more claims are marked as critical, but they are missing or have not been checked (%s).', json_encode(array_values($diff))));
 }
開發者ID:spomky-labs,項目名稱:jose,代碼行數:12,代碼來源:CriticalHeaderChecker.php

示例14: unbind

 public function unbind($value) : Data
 {
     Assertion::isArray($value);
     $data = Data::none();
     foreach ($value as $index => $individualValue) {
         $data = $data->merge($this->wrappedMapping->withPrefixAndRelativeKey($this->key, (string) $index)->unbind($individualValue));
     }
     return $data;
 }
開發者ID:dasprid,項目名稱:formidable,代碼行數:9,代碼來源:RepeatedMapping.php

示例15: guardRequiredState

 protected function guardRequiredState()
 {
     parent::guardRequiredState();
     Assertion::isArray($this->data);
     $mandatory_attribute_names = ['identifier', 'uuid', 'language', 'version', 'workflow_state'];
     foreach ($mandatory_attribute_names as $attribute_name) {
         Assertion::keyExists($this->data, $attribute_name, 'mandatory');
     }
 }
開發者ID:honeybee,項目名稱:honeybee,代碼行數:9,代碼來源:AggregateRootCreatedEvent.php


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