本文整理汇总了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;
}
示例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;
}
示例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());
}
示例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');
}
示例5: setLegs
/**
* @param LegDto[] $legs
*/
public function setLegs(array $legs) : array
{
foreach ($legs as $leg) {
Assertion::isInstanceOf($leg, LegDto::class);
}
$this->legs = $legs;
}
示例6: __construct
/**
* FilesCollection constructor.
*
* @param File[] $files
*/
public function __construct(array $files)
{
foreach ($files as $file) {
Assertion::isInstanceOf($file, File::class);
}
$this->files = $files;
}
示例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');
}
}
示例8: _validateIpnListeners
protected function _validateIpnListeners()
{
Assertion::notEmpty($this->ipnListeners);
foreach ($this->ipnListeners as $ipn_listener) {
Assertion::isInstanceOf($ipn_listener, PaymentListener::class);
}
}
示例9: fromFileMakerValue
public function fromFileMakerValue($value)
{
if (null === $value) {
return null;
}
Assertion::isInstanceOf($value, StreamInterface::class);
return $value;
}
示例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;
}
示例11: toFileMakerValue
public function toFileMakerValue($value)
{
if (null === $value) {
return null;
}
Assertion::isInstanceOf($value, Decimal::class);
return $value;
}
示例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;
}
示例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;
}
示例14: fromFileMakerValue
public function fromFileMakerValue($value)
{
if (null === $value) {
return null;
}
Assertion::isInstanceOf($value, Decimal::class);
return $value->asInteger();
}
示例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());
}