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


PHP Assert::allIsInstanceOf方法代码示例

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


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

示例1: startConversation

 /**
  * {@inheritdoc}
  */
 public function startConversation(PersonInterface $sender, $recipient, $body, $subject = null)
 {
     if (!is_array($recipient) && !$recipient instanceof \Traversable) {
         $recipient = [$recipient];
     }
     Assert::allIsInstanceOf($recipient, 'FOS\\Message\\Model\\PersonInterface', '$recipient expected ether an instance or a collection of PersonInterface in Sender::startConversation().');
     Assert::string($body, '$body expected a string in Sender::startConversation(). Got: %s');
     Assert::nullOrString($subject, '$subject expected either a string or null in Sender::startConversation(). Got: %s');
     // Create conversation and message
     $conversation = $this->createAndPersistConversation($subject);
     $message = $this->createAndPersistMessage($conversation, $sender, $body);
     // Add the recipients links
     foreach ($recipient as $person) {
         $this->createAndPersistConversationPerson($conversation, $person);
         $this->createAndPersistMessagePerson($message, $person, false);
     }
     // Add the sender link
     $this->createAndPersistConversationPerson($conversation, $sender);
     $this->createAndPersistMessagePerson($message, $sender, true);
     // Flush the previously persisted entities
     $this->driver->flush();
     // Dispatch the event
     $this->dispatchConversationEvent($conversation, $message);
     return $conversation;
 }
开发者ID:jbinfo,项目名称:FOSMessage,代码行数:28,代码来源:Sender.php

示例2: __construct

 /**
  * Creates a new version list.
  *
  * @param string         $path     The Puli path.
  * @param PuliResource[] $versions The versions of the resource, starting
  *                                 with the first.
  */
 public function __construct($path, array $versions)
 {
     Assert::stringNotEmpty($path, 'The Puli path must be a non-empty string. Got: %s');
     Assert::allIsInstanceOf($versions, 'Puli\\Repository\\Api\\Resource\\PuliResource');
     Assert::greaterThanEq(count($versions), 1, 'Expected at least one version.');
     $this->path = $path;
     $this->versions = array_values($versions);
 }
开发者ID:puli,项目名称:repository,代码行数:15,代码来源:VersionList.php

示例3: __construct

 /**
  * Construct.
  *
  * @param Filter[]  $filters    Filters.
  * @param Validator $validator  Alias validator.
  * @param string    $tableName  The table name.
  * @param string    $aliasField The alias field.
  * @param string    $separator  Value separator.
  */
 public function __construct($filters, Validator $validator, $tableName, $aliasField = 'alias', $separator = '-')
 {
     Assert::allIsInstanceOf($filters, 'Netzmacht\\Contao\\Toolkit\\Data\\Alias\\Filter');
     $this->validator = $validator;
     $this->aliasField = $aliasField;
     $this->tableName = $tableName;
     $this->separator = $separator;
     $this->filters = $filters;
 }
开发者ID:netzmacht,项目名称:contao-toolkit,代码行数:18,代码来源:FilterBasedAliasGenerator.php

示例4: getCurrentPageWithForm

 /**
  * {@inheritdoc}
  * 
  * @throws \LogicException
  */
 public function getCurrentPageWithForm(array $pages)
 {
     $routeParameters = $this->urlMatcher->match(parse_url($this->session->getCurrentUrl(), PHP_URL_PATH));
     Assert::allIsInstanceOf($pages, SymfonyPageInterface::class);
     foreach ($pages as $page) {
         if ($routeParameters['_route'] === $page->getRouteName()) {
             return $page;
         }
     }
     throw new \LogicException('Route name could not be matched to provided pages.');
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:16,代码来源:CurrentPageResolver.php

示例5: __construct

 /**
  * Creates a new type.
  *
  * @param string             $name       The name of the type.
  * @param BindingParameter[] $parameters The parameters that can be set
  *                                       during binding.
  */
 public function __construct($name, array $parameters = array())
 {
     Assert::stringNotEmpty($name, 'The type name must be a non-empty string. Got: %s');
     Assert::startsWithLetter($name, 'The type name must start with a letter. Got: %s');
     Assert::allIsInstanceOf($parameters, 'Puli\\Discovery\\Api\\Binding\\BindingParameter');
     $this->name = $name;
     foreach ($parameters as $parameter) {
         $this->parameters[$parameter->getName()] = $parameter;
     }
     // Sort to facilitate comparison
     ksort($this->parameters);
 }
开发者ID:kormik,项目名称:discovery,代码行数:19,代码来源:BindingType.php

示例6: __construct

 /**
  * Creates a new type.
  *
  * @param string             $name         The name of the type.
  * @param string             $bindingClass The class name of the accepted
  *                                         bindings.
  * @param BindingParameter[] $parameters   The parameters that can be set
  *                                         for a binding.
  */
 public function __construct($name, $bindingClass, array $parameters = array())
 {
     Assert::stringNotEmpty($name, 'The type name must be a non-empty string. Got: %s');
     Assert::allIsInstanceOf($parameters, 'Puli\\Discovery\\Api\\Type\\BindingParameter');
     if (!class_exists($bindingClass) && !interface_exists($bindingClass)) {
         throw new InvalidArgumentException(sprintf('The binding class "%s" is neither a class nor an ' . 'interface name. Is there a typo?', $bindingClass));
     }
     $this->name = $name;
     $this->acceptedBindingClass = $bindingClass;
     foreach ($parameters as $parameter) {
         $this->parameters[$parameter->getName()] = $parameter;
     }
     // Sort to facilitate comparison
     ksort($this->parameters);
 }
开发者ID:webmozart,项目名称:discovery,代码行数:24,代码来源:BindingType.php

示例7: __construct

 /**
  * Creates a new migration manager.
  *
  * @param JsonMigration[]    $migrations The migrations migrating a JSON
  *                                       object between individual versions
  * @param JsonVersioner|null $versioner  The versioner that should be used
  */
 public function __construct(array $migrations, JsonVersioner $versioner = null)
 {
     Assert::allIsInstanceOf($migrations, __NAMESPACE__ . '\\JsonMigration');
     $this->versioner = $versioner ?: new SchemaUriVersioner();
     foreach ($migrations as $migration) {
         $this->migrationsBySourceVersion[$migration->getSourceVersion()] = $migration;
         $this->migrationsByTargetVersion[$migration->getTargetVersion()] = $migration;
         $this->knownVersions[] = $migration->getSourceVersion();
         $this->knownVersions[] = $migration->getTargetVersion();
     }
     $this->knownVersions = array_unique($this->knownVersions);
     uksort($this->migrationsBySourceVersion, 'version_compare');
     uksort($this->migrationsByTargetVersion, 'version_compare');
     usort($this->knownVersions, 'version_compare');
 }
开发者ID:webmozart,项目名称:json,代码行数:22,代码来源:MigrationManager.php

示例8: __construct

 /**
  * @param string $summary
  * @param DocBlock\Description $description
  * @param DocBlock\Tag[] $tags
  * @param Types\Context $context The context in which the DocBlock occurs.
  * @param Location $location The location within the file that this DocBlock occurs in.
  * @param bool $isTemplateStart
  * @param bool $isTemplateEnd
  */
 public function __construct($summary = '', DocBlock\Description $description = null, array $tags = [], Types\Context $context = null, Location $location = null, $isTemplateStart = false, $isTemplateEnd = false)
 {
     Assert::string($summary);
     Assert::boolean($isTemplateStart);
     Assert::boolean($isTemplateEnd);
     Assert::allIsInstanceOf($tags, Tag::class);
     $this->summary = $summary;
     $this->description = $description ?: new DocBlock\Description('');
     foreach ($tags as $tag) {
         $this->addTag($tag);
     }
     $this->context = $context;
     $this->location = $location;
     $this->isTemplateEnd = $isTemplateEnd;
     $this->isTemplateStart = $isTemplateStart;
 }
开发者ID:timpressive,项目名称:art-auction,代码行数:25,代码来源:DocBlock.php

示例9: setRecipients

 /**
  * @param \AppBundle\Entity\User[] $recipients
  */
 public function setRecipients($recipients)
 {
     \Webmozart\Assert\Assert::allIsInstanceOf($recipients, User::class);
     \Webmozart\Assert\Assert::notEmpty($recipients);
     $this->recipients = $recipients;
 }
开发者ID:tgalopin,项目名称:FOSMessage-demo,代码行数:9,代码来源:StartConversationModel.php

示例10: __construct

 /**
  * @param PromotionEligibilityCheckerInterface[] $promotionEligibilityCheckers
  */
 public function __construct(array $promotionEligibilityCheckers)
 {
     Assert::notEmpty($promotionEligibilityCheckers);
     Assert::allIsInstanceOf($promotionEligibilityCheckers, PromotionEligibilityCheckerInterface::class);
     $this->promotionEligibilityCheckers = $promotionEligibilityCheckers;
 }
开发者ID:loic425,项目名称:Sylius,代码行数:9,代码来源:CompositePromotionEligibilityChecker.php

示例11: assertApplicatorsHaveCorrectType

 /**
  * @param OrderTaxesApplicatorInterface[] $applicators
  */
 private function assertApplicatorsHaveCorrectType(array $applicators)
 {
     Assert::allIsInstanceOf($applicators, OrderTaxesApplicatorInterface::class, 'Order taxes applicator should have type "%2$s". Got: %s');
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:7,代码来源:TaxCalculationStrategy.php

示例12: __construct

 /**
  * Construct.
  *
  * @param ValueFormatter[]|array $filters List of filters.
  */
 public function __construct(array $filters)
 {
     Assert::allIsInstanceOf($filters, 'Netzmacht\\Contao\\Toolkit\\Dca\\Formatter\\Value\\ValueFormatter');
     $this->filters = $filters;
 }
开发者ID:netzmacht,项目名称:contao-toolkit,代码行数:10,代码来源:FilterFormatter.php

示例13: merge

 /**
  * {@inheritdoc}
  */
 public function merge($resources)
 {
     Assert::allIsInstanceOf($resources, 'Puli\\Repository\\Api\\Resource\\Resource');
     // only start merging after validating all resources
     foreach ($resources as $resource) {
         $this->resources[] = $resource;
     }
 }
开发者ID:SenseException,项目名称:repository,代码行数:11,代码来源:ArrayResourceCollection.php


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