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


PHP Assert::notNull方法代码示例

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


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

示例1: calculate

 /**
  * {@inheritdoc}
  */
 public function calculate(ProductVariantInterface $productVariant, array $context)
 {
     Assert::keyExists($context, 'channel');
     $channelPricing = $productVariant->getChannelPricingForChannel($context['channel']);
     Assert::notNull($channelPricing);
     return $channelPricing->getPrice();
 }
开发者ID:sylius,项目名称:core,代码行数:10,代码来源:ProductVariantPriceCalculator.php

示例2: getCountryByName

 /**
  * @Transform /^country "([^"]+)"$/
  * @Transform /^"([^"]+)" country$/
  * @Transform /^"([^"]+)" as shipping country$/
  */
 public function getCountryByName($countryName)
 {
     $countryCode = $this->countryNameConverter->convertToCode($countryName);
     $country = $this->countryRepository->findOneBy(['code' => $countryCode]);
     Assert::notNull($country, sprintf('Country with name "%s" does not exist', $countryName));
     return $country;
 }
开发者ID:loic425,项目名称:Sylius,代码行数:12,代码来源:CountryContext.php

示例3: create

 /**
  * Create the tag
  *
  * @param string             $body               Tag body
  * @param DescriptionFactory $descriptionFactory The description factory
  * @param Context|null       $context            The Context is used to resolve Types and FQSENs, although optional
  *                                               it is highly recommended to pass it. If you omit it then it is assumed that
  *                                               the DocBlock is in the global namespace and has no `use` statements.
  *
  * @return SleepTime
  */
 public static function create($body, DescriptionFactory $descriptionFactory = null, Context $context = null)
 {
     Assert::integerish($body, self::MSG);
     Assert::greaterThanEq($body, 0, self::MSG);
     Assert::notNull($descriptionFactory);
     return new static($descriptionFactory->create($body, $context));
 }
开发者ID:alorel,项目名称:phpunit-auto-rerun,代码行数:18,代码来源:SleepTime.php

示例4: iAmLoggedInAsAdministrator

 /**
  * @Given /^I am logged in as "([^"]+)" administrator$/
  */
 public function iAmLoggedInAsAdministrator($email)
 {
     $user = $this->userRepository->findOneByEmail($email);
     Assert::notNull($user);
     $this->securityService->logIn($user);
     $this->sharedStorage->set('admin', $user);
 }
开发者ID:origammi,项目名称:Sylius,代码行数:10,代码来源:AdminSecurityContext.php

示例5: setPositionOfProduct

 /**
  * {@inheritdoc}
  */
 public function setPositionOfProduct($productName, $position)
 {
     /** @var NodeElement $productsRow */
     $productsRow = $this->getElement('table')->find('css', sprintf('tbody > tr:contains("%s")', $productName));
     Assert::notNull($productsRow, 'There are no row with given product\'s name!');
     $productsRow->find('css', '.sylius-product-taxon-position')->setValue($position);
 }
开发者ID:Niiko,项目名称:Sylius,代码行数:10,代码来源:IndexPerTaxonPage.php

示例6: create

 /**
  * Creates a new tag that represents any unknown tag type.
  *
  * @param string             $body
  * @param string             $name
  * @param DescriptionFactory $descriptionFactory
  * @param Context            $context
  *
  * @return static
  */
 public static function create($body, $name = '', DescriptionFactory $descriptionFactory = null, Context $context = null)
 {
     Assert::string($body);
     Assert::stringNotEmpty($name);
     Assert::notNull($descriptionFactory);
     $description = $descriptionFactory && $body ? $descriptionFactory->create($body, $context) : null;
     return new static($name, $description);
 }
开发者ID:mbed67,项目名称:ReflectionDocBlock,代码行数:18,代码来源:Generic.php

示例7: update

 /**
  * {@inheritdoc}
  *
  * @throws \InvalidArgumentException
  */
 public function update(OrderInterface $order)
 {
     $currencyCode = $order->getCurrencyCode();
     /** @var CurrencyInterface $currency */
     $currency = $this->currencyRepository->findOneBy(['code' => $currencyCode]);
     Assert::notNull($currency);
     $order->setExchangeRate($currency->getExchangeRate());
 }
开发者ID:loic425,项目名称:Sylius,代码行数:13,代码来源:OrderExchangeRateUpdater.php

示例8: create

 /**
  * {@inheritdoc}
  */
 public static function create($body, DescriptionFactory $descriptionFactory = null, TypeContext $context = null)
 {
     Assert::string($body);
     Assert::notNull($descriptionFactory);
     $parts = preg_split('/\\s+/Su', $body, 2);
     $description = isset($parts[1]) ? $descriptionFactory->create($parts[1], $context) : null;
     return new static($parts[0], $description);
 }
开发者ID:levanigongadze,项目名称:Labweb,代码行数:11,代码来源:Link.php

示例9: getOrderByCustomer

 /**
  * @Transform /^this order made by "([^"]+)"$/
  */
 public function getOrderByCustomer($email)
 {
     $customer = $this->customerRepository->findOneBy(['email' => $email]);
     Assert::notNull($customer, sprintf('Cannot find customer with email %s.', $email));
     $orders = $this->orderRepository->findByCustomer($customer);
     Assert::notEmpty($orders);
     return end($orders);
 }
开发者ID:okwinza,项目名称:Sylius,代码行数:11,代码来源:OrderContext.php

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

示例11: createForPromotion

 /**
  * {@inheritdoc}
  */
 public function createForPromotion($promotionId)
 {
     /** @var PromotionInterface $promotion */
     Assert::notNull($promotion = $this->promotionRepository->find($promotionId), sprintf('Promotion with id %s does not exist.', $promotionId));
     Assert::true($promotion->isCouponBased(), sprintf('Promotion with name %s is not coupon based.', $promotion->getName()));
     $coupon = $this->factory->createNew();
     $coupon->setPromotion($promotion);
     return $coupon;
 }
开发者ID:okwinza,项目名称:Sylius,代码行数:12,代码来源:CouponFactory.php

示例12: pressDelete

 /**
  * {@inheritdoc}
  */
 public function pressDelete()
 {
     $this->getDocument()->pressButton('Delete');
     $modal = $this->getDocument()->find('css', '#confirmation-modal');
     Assert::notNull($modal, 'Confirmation modal not found!');
     $confirmButton = $modal->find('css', 'a:contains(Delete)');
     $this->waitForModalToAppear($modal);
     $confirmButton->press();
 }
开发者ID:rpg600,项目名称:Sylius,代码行数:12,代码来源:ShowPage.php

示例13: prepareCaptureAction

 /**
  * @param Request $request
  * @param $lastNewPaymentId
  *
  * @return Response
  */
 public function prepareCaptureAction(Request $request, $lastNewPaymentId)
 {
     $configuration = $this->requestConfigurationFactory->create($this->paymentMetadata, $request);
     $payment = $this->paymentRepository->find($lastNewPaymentId);
     Assert::notNull($payment);
     $request->getSession()->set('sylius_order_id', $payment->getOrder()->getId());
     $captureToken = $this->getTokenFactory()->createCaptureToken($payment->getMethod()->getGateway(), $payment, $configuration->getParameters()->get('redirect[route]', null, true), $configuration->getParameters()->get('redirect[parameters]', [], true));
     $view = View::createRedirect($captureToken->getTargetUrl());
     return $this->viewHandler->handle($configuration, $view);
 }
开发者ID:TheMadeleine,项目名称:Sylius,代码行数:16,代码来源:PayumController.php

示例14: myDefaultAddressIsOf

 /**
  * @Given /^(my) default address is of "([^"]+)"$/
  */
 public function myDefaultAddressIsOf(ShopUserInterface $user, $fullName)
 {
     list($firstName, $lastName) = explode(' ', $fullName);
     /** @var AddressInterface $address */
     $address = $this->addressRepository->findOneBy(['firstName' => $firstName, 'lastName' => $lastName]);
     Assert::notNull($address, sprintf('The address of "%s" has not been found.', $fullName));
     /** @var CustomerInterface $customer */
     $customer = $user->getCustomer();
     $this->setDefaultAddressOfCustomer($customer, $address);
 }
开发者ID:sylius,项目名称:sylius,代码行数:13,代码来源:AddressContext.php

示例15: generate

 /**
  * {@inheritdoc}
  */
 public function generate($name, $parentId = null)
 {
     $taxonSlug = Transliterator::transliterate($name);
     if (null === $parentId) {
         return $taxonSlug;
     }
     /** @var TaxonInterface $parent */
     $parent = $this->taxonRepository->find($parentId);
     Assert::notNull($parent, sprintf('There is no parent taxon with id %d.', $parentId));
     return $parent->getSlug() . self::SLUG_SEPARATOR . $taxonSlug;
 }
开发者ID:loic425,项目名称:Sylius,代码行数:14,代码来源:TaxonSlugGenerator.php


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