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


PHP Assert::isInstanceOf方法代码示例

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


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

示例1: onCheckoutComplete

 /**
  * {@inheritdoc}
  */
 public function onCheckoutComplete(GenericEvent $event)
 {
     /** @var OrderInterface $order */
     $order = $event->getSubject();
     Assert::isInstanceOf($order, OrderInterface::class);
     $this->session->set('sylius_order_id', $order->getId());
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:10,代码来源:CheckoutCompleteListener.php

示例2: preSetData

 /**
  * @param FormEvent $event
  */
 public function preSetData(FormEvent $event)
 {
     /** @var ProductInterface $product */
     $product = $event->getData();
     Assert::isInstanceOf($product, ProductInterface::class);
     $this->generator->generate($product);
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:10,代码来源:GenerateProductVariantsSubscriber.php

示例3: supports

 /**
  * {@inheritdoc}
  */
 public function supports(OrderInterface $order, ZoneInterface $zone)
 {
     $channel = $order->getChannel();
     /** @var ChannelInterface $channel */
     Assert::isInstanceOf($channel, ChannelInterface::class);
     return $channel->getTaxCalculationStrategy() === $this->type;
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:10,代码来源:TaxCalculationStrategy.php

示例4: uploadTaxonImage

 /**
  * @param GenericEvent $event
  */
 public function uploadTaxonImage(GenericEvent $event)
 {
     $subject = $event->getSubject();
     Assert::isInstanceOf($subject, TaxonInterface::class);
     if ($subject->hasFile()) {
         $this->uploader->upload($subject);
     }
 }
开发者ID:TeamNovatek,项目名称:Sylius,代码行数:11,代码来源:ImageUploadListener.php

示例5: sendVerificationEmail

 /**
  * @param GenericEvent $event
  */
 public function sendVerificationEmail(GenericEvent $event)
 {
     $customer = $event->getSubject();
     Assert::isInstanceOf($customer, CustomerInterface::class);
     $user = $customer->getUser();
     Assert::notNull($user);
     $this->handleUserVerificationToken($user);
 }
开发者ID:loic425,项目名称:Sylius,代码行数:11,代码来源:UserRegistrationListener.php

示例6: selectElementFromAttributesDropdown

 /**
  * @param int $id
  */
 private function selectElementFromAttributesDropdown($id)
 {
     /** @var Selenium2Driver $driver */
     $driver = $this->getDriver();
     Assert::isInstanceOf($driver, Selenium2Driver::class);
     $driver->executeScript('$(\'[name="sylius_product_attribute_choice"]\').dropdown(\'show\');');
     $driver->executeScript(sprintf('$(\'[name="sylius_product_attribute_choice"]\').dropdown(\'set selected\', %s);', $id));
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:11,代码来源:CreateSimpleProductPage.php

示例7: transform

 /**
  * {@inheritdoc}
  */
 public function transform($value)
 {
     if (null === $value) {
         return null;
     }
     Assert::isInstanceOf($value, $this->repository->getClassName());
     return PropertyAccess::createPropertyAccessor()->getValue($value, $this->identifier);
 }
开发者ID:NeverResponse,项目名称:Sylius,代码行数:11,代码来源:ResourceToIdentifierTransformer.php

示例8: isEligible

 /**
  * {@inheritdoc}
  */
 public function isEligible(PromotionSubjectInterface $subject, array $configuration)
 {
     Assert::isInstanceOf($subject, OrderInterface::class);
     $channelCode = $subject->getChannel()->getCode();
     if (!isset($configuration[$channelCode])) {
         return false;
     }
     return $this->itemTotalRuleChecker->isEligible($subject, $configuration[$channelCode]);
 }
开发者ID:sylius,项目名称:core,代码行数:12,代码来源:ItemTotalRuleChecker.php

示例9: process

 /**
  * {@inheritdoc}
  */
 public function process(OrderInterface $order)
 {
     /** @var CoreOrderInterface $order */
     Assert::isInstanceOf($order, CoreOrderInterface::class);
     if (OrderInterface::STATE_CANCELLED === $order->getState()) {
         return;
     }
     $this->exchangeRateUpdater->update($order);
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:12,代码来源:OrderExchangeRateProcessor.php

示例10: render

 /**
  * {@inheritdoc}
  */
 public function render(Field $field, $data, array $options)
 {
     $value = $this->dataExtractor->get($field, $data);
     if (null === $value) {
         return null;
     }
     Assert::isInstanceOf($value, \DateTime::class);
     return $value->format($options['format']);
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:12,代码来源:DatetimeFieldType.php

示例11: reverseTransform

 /**
  * {@inheritdoc}
  */
 public function reverseTransform($value)
 {
     if (null === $value) {
         return null;
     }
     $class = $this->repository->getClassName();
     Assert::isInstanceOf($value, $class);
     $accessor = PropertyAccess::createPropertyAccessor();
     return $accessor->getValue($value, $this->identifier);
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:13,代码来源:IdentifierToResourceTransformer.php

示例12: preSetData

 /**
  * @param FormEvent $event
  */
 public function preSetData(FormEvent $event)
 {
     /** @var ProductInterface $product */
     $product = $event->getData();
     Assert::isInstanceOf($product, ProductInterface::class);
     $form = $event->getForm();
     /** Options should be disabled for configurable product if it has at least one defined variant */
     $disableOptions = null !== $product->getFirstVariant() && false === $product->hasVariants();
     $form->add('options', 'sylius_product_option_choice', ['required' => false, 'disabled' => $disableOptions, 'multiple' => true, 'label' => 'sylius.form.product.options']);
 }
开发者ID:okwinza,项目名称:Sylius,代码行数:13,代码来源:ProductOptionFieldSubscriber.php

示例13: deleteUser

 /**
  * @param GenericEvent $event
  *
  * @throws \InvalidArgumentException
  */
 public function deleteUser(GenericEvent $event)
 {
     $user = $event->getSubject();
     Assert::isInstanceOf($user, UserInterface::class);
     $token = $this->tokenStorage->getToken();
     if (null !== $token && ($loggedUser = $token->getUser()) && $loggedUser->getId() === $user->getId()) {
         $event->stopPropagation();
         $this->session->getBag('flashes')->add('error', 'Cannot remove currently logged in user.');
     }
 }
开发者ID:loic425,项目名称:Sylius,代码行数:15,代码来源:UserDeleteListener.php

示例14: preSetData

 /**
  * @param FormEvent $event
  */
 public function preSetData(FormEvent $event)
 {
     /** @var ProductInterface $product */
     $product = $event->getData();
     Assert::isInstanceOf($product, ProductInterface::class);
     if ($product->isSimple()) {
         $form = $event->getForm();
         $form->add('variant', 'sylius_product_variant', ['property_path' => 'variants[0]']);
         $form->remove('options');
     }
 }
开发者ID:gabiudrescu,项目名称:Sylius,代码行数:14,代码来源:SimpleProductSubscriber.php

示例15: preSetData

 /**
  * @param FormEvent $event
  */
 public function preSetData(FormEvent $event)
 {
     $form = $event->getForm();
     /** @var ReviewInterface $review */
     $review = $event->getData();
     $author = $form->getConfig()->getOption('author');
     Assert::isInstanceOf($review, ReviewInterface::class);
     if (null === $author && null === $review->getAuthor()) {
         $form->add('author', 'sylius_customer_guest');
     }
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:14,代码来源:AddAuthorGuestTypeFormSubscriber.php


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