当前位置: 首页>>代码示例>>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;未经允许,请勿转载。