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


PHP Assertion::isInstanceOf方法代码示例

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


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

示例1: getReadModel

 /**
  * @param $partId
  * @return \Modules\Parts\ReadModel\PartsThatWereManufactured
  */
 public function getReadModel($partId)
 {
     $partId = (string) $partId;
     $readModel = $this->repository->find($partId);
     Assertion::isInstanceOf($readModel, PartsThatWereManufactured::class);
     return $readModel;
 }
开发者ID:Konafets,项目名称:Laravel-Broadway-Demo,代码行数:11,代码来源:PartsThatWereManufacturedProjector.php

示例2: createService

 /**
  * @param ServiceLocatorInterface $serviceLocator
  *
  * @return CommonReport
  * @throws \Zend\ServiceManager\Exception\ServiceNotFoundException
  * @throws \Assert\AssertionFailedException
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $appServiceLocator = $serviceLocator instanceof AbstractPluginManager ? $serviceLocator->getServiceLocator() : $serviceLocator;
     /** @var ModuleOptionsPluginManagerInterface $moduleOptionsManager */
     $moduleOptionsManager = $appServiceLocator->get(ModuleOptionsPluginManagerInterface::class);
     Assertion::isInstanceOf($moduleOptionsManager, ModuleOptionsPluginManagerInterface::class, sprintf('Module options manager not implement %s', ModuleOptionsPluginManagerInterface::class));
     /** @var ModuleOptions $moduleOptions */
     $moduleOptions = $moduleOptionsManager->get(ModuleOptions::class);
     Assertion::isInstanceOf($moduleOptions, ModuleOptions::class, sprintf('Module options not implement %s', ModuleOptions::class));
     /** @var GoogleSheetsStorageBuilder $googleSheetsStorageBuilder */
     $googleSheetsStorageBuilder = $appServiceLocator->get(GoogleSheetsStorageBuilder::class);
     Assertion::isInstanceOf($googleSheetsStorageBuilder, GoogleSheetsStorageBuilder::class, sprintf('GoogleSheetsStorageBuilder not implement %s', GoogleSheetsStorageBuilder::class));
     /** @var GitLabDataStorageBuilder $gitLabDataStorageBuilder */
     $gitLabDataStorageBuilder = $appServiceLocator->get(GitLabDataStorageBuilder::class);
     Assertion::isInstanceOf($gitLabDataStorageBuilder, GitLabDataStorageBuilder::class, sprintf('GitLabDataStorageBuilder not implement %s', GitLabDataStorageBuilder::class));
     $report = new CommonReport($googleSheetsStorageBuilder, $gitLabDataStorageBuilder);
     if ($report instanceof LoggerAwareInterface) {
         $loggerName = $moduleOptions->getLogger();
         if (null !== $loggerName) {
             /** @var LoggerInterface  $logger */
             $logger = $appServiceLocator->get($loggerName);
             Assertion::isInstanceOf($logger, LoggerInterface::class, sprintf('Log  not implement %s', LoggerInterface::class));
             $report->setLogger($logger);
         }
     }
     return $report;
 }
开发者ID:old-town-gitlab-tools,项目名称:analizator,代码行数:34,代码来源:CommonReportFactory.php

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

示例4: iHaveSomeGeneratedConfigAt

 /**
  * @Given /^I have some generated config at "([^"]*)"$/
  */
 public function iHaveSomeGeneratedConfigAt($arg1)
 {
     $this->configFilePath = getcwd() . "/{$arg1}/";
     Assertion::file($this->configFilePath . 'configured.json');
     $this->config = json_decode(file_get_contents($this->configFilePath . 'configured.json'));
     Assertion::isInstanceOf($this->config, 'stdClass');
 }
开发者ID:benconstable,项目名称:quick-configure,代码行数:10,代码来源:FeatureContext.php

示例5: setLegs

 /**
  * @param LegDto[] $legs
  */
 public function setLegs(array $legs) : array
 {
     foreach ($legs as $leg) {
         Assertion::isInstanceOf($leg, LegDto::class);
     }
     $this->legs = $legs;
 }
开发者ID:RossJHagan,项目名称:php-ddd-cargo-sample,代码行数:10,代码来源:CargoRoutingDto.php

示例6: __construct

 /**
  * FilesCollection constructor.
  *
  * @param File[] $files
  */
 public function __construct(array $files)
 {
     foreach ($files as $file) {
         Assertion::isInstanceOf($file, File::class);
     }
     $this->files = $files;
 }
开发者ID:bruli,项目名称:php-git-hooks,代码行数:12,代码来源:FilesCollection.php

示例7: validate

 /**
  * @param CreateCoupon $createCoupon
  */
 public function validate(DtoInterface $createCoupon)
 {
     Assertion::isInstanceOf($createCoupon, 'Matthias\\LeanpubApi\\Dto\\CreateCoupon');
     if (count($createCoupon->getPackageDiscounts()) === 0) {
         throw new BadRequestException('Coupon should have at least one package discount, one of which can be for the "book" package');
     }
 }
开发者ID:matthiasnoback,项目名称:leanpub-api-client,代码行数:10,代码来源:CreateCouponValidator.php

示例8: _validateIpnListeners

 protected function _validateIpnListeners()
 {
     Assertion::notEmpty($this->ipnListeners);
     foreach ($this->ipnListeners as $ipn_listener) {
         Assertion::isInstanceOf($ipn_listener, PaymentListener::class);
     }
 }
开发者ID:PhillipMwaniki,项目名称:pesapal-1,代码行数:7,代码来源:Config.php

示例9: fromFileMakerValue

 public function fromFileMakerValue($value)
 {
     if (null === $value) {
         return null;
     }
     Assertion::isInstanceOf($value, StreamInterface::class);
     return $value;
 }
开发者ID:soliantconsulting,项目名称:simplefm,代码行数:8,代码来源:StreamType.php

示例10: __construct

 /**
  * @param TaskListId $taskListId
  * @param TaskListEntry[] $taskListEntries
  */
 private function __construct(TaskListId $taskListId, array $taskListEntries)
 {
     foreach ($taskListEntries as $taskListEntry) {
         Assertion::isInstanceOf($taskListEntry, 'Prooph\\Processing\\Processor\\Task\\TaskListEntry');
     }
     $this->taskListEntries = $taskListEntries;
     $this->taskListId = $taskListId;
 }
开发者ID:prooph,项目名称:processing,代码行数:12,代码来源:TaskList.php

示例11: toFileMakerValue

 public function toFileMakerValue($value)
 {
     if (null === $value) {
         return null;
     }
     Assertion::isInstanceOf($value, Decimal::class);
     return $value;
 }
开发者ID:soliantconsulting,项目名称:simplefm,代码行数:8,代码来源:DecimalType.php

示例12: __construct

 /**
  * @param Adapter $snapshotAdapter
  */
 public function __construct(Adapter $snapshotAdapter, array $aggregateRepositories)
 {
     foreach ($aggregateRepositories as $aggregateRepository) {
         Assertion::isInstanceOf($aggregateRepository, AggregateRepository::class);
     }
     $this->snapshotAdapter = $snapshotAdapter;
     $this->aggregateRepositories = $aggregateRepositories;
 }
开发者ID:bweston92,项目名称:snapshotter,代码行数:11,代码来源:Snapshotter.php

示例13: __construct

 /**
  * @param StreamName $streamName
  * @param Message[] $streamEvents
  */
 public function __construct(StreamName $streamName, array $streamEvents)
 {
     foreach ($streamEvents as $streamEvent) {
         Assertion::isInstanceOf($streamEvent, Message::class);
     }
     $this->streamName = $streamName;
     $this->streamEvents = $streamEvents;
 }
开发者ID:ad3n,项目名称:event-store,代码行数:12,代码来源:Stream.php

示例14: fromFileMakerValue

 public function fromFileMakerValue($value)
 {
     if (null === $value) {
         return null;
     }
     Assertion::isInstanceOf($value, Decimal::class);
     return $value->asInteger();
 }
开发者ID:soliantconsulting,项目名称:simplefm,代码行数:8,代码来源:IntegerType.php

示例15: delete

 public function delete($identifier, SettingsInterface $settings = null)
 {
     $arguments = $settings->get('arguments');
     Assertion::isInstanceOf($arguments, SettingsInterface::CLASS);
     $exchange = $this->getConfig()->get('exchange');
     $channel = $this->connector->getConnection()->channel();
     $channel->exchange_unbind($exchange, $exchange, $identifier, false, $arguments->toArray());
 }
开发者ID:honeybee,项目名称:honeybee,代码行数:8,代码来源:StructureVersionListWriter.php


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