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


PHP Collection::isEmpty方法代码示例

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


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

示例1: hasAnyAccess

 /**
  * Returns if access is available for any given permissions.
  *
  * @param  array|string $permissions
  *
  * @return bool
  */
 public function hasAnyAccess($permissions)
 {
     if ($this->permissions->isEmpty()) {
         $this->mergePermissions($this->userPermissions, $this->rolePermissions);
     }
     if (func_num_args() > 1) {
         $permissions = func_get_args();
     }
     foreach ((array) $permissions as $permissionName) {
         if ($this->allows($permissionName)) {
             return true;
         }
     }
     return false;
 }
开发者ID:digbang,项目名称:security,代码行数:22,代码来源:LazyPermissionsTrait.php

示例2: getTransformations

 /**
  * @return \Doctrine\Common\Collections\Collection
  */
 public function getTransformations()
 {
     if ($this->transformations->isEmpty()) {
         $this->initialize();
     }
     return $this->transformations;
 }
开发者ID:antimattr,项目名称:etl,代码行数:10,代码来源:TaskTrait.php

示例3: testClear

 public function testClear()
 {
     $this->_coll[] = 'one';
     $this->_coll[] = 'two';
     $this->_coll->clear();
     $this->assertEquals($this->_coll->isEmpty(), true);
 }
开发者ID:GMBN,项目名称:ZF2---DoctrineModule---ManyToOne-,代码行数:7,代码来源:CollectionTest.php

示例4: getImage

 /**
  * {@inheritdoc}
  */
 public function getImage()
 {
     if ($this->images->isEmpty()) {
         return null;
     }
     return $this->images->first();
 }
开发者ID:steffenbrem,项目名称:sylius,代码行数:10,代码来源:ProductVariant.php

示例5: getImage

 /**
  * {@inheritdoc}
  */
 public function getImage()
 {
     if ($this->images->isEmpty()) {
         return $this->getProduct()->getImage();
     }
     return $this->images->first();
 }
开发者ID:malukenho,项目名称:Sylius,代码行数:10,代码来源:ProductVariant.php

示例6: getCountTotalEntries

 /**
  * Returns the total number of entries from all the feeds.
  *
  * @return int
  */
 public function getCountTotalEntries()
 {
     if ($this->feeds->isEmpty()) {
         return 0;
     }
     /** @var FeedEntryRepository $feedEntryRepository */
     $feedEntryRepository = $this->em->getRepository('Phraseanet:FeedEntry');
     return $feedEntryRepository->countByFeeds($this->feeds->getKeys());
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:14,代码来源:Aggregate.php

示例7:

 function it_doesnt_apply_any_taxes_if_zone_is_missing(OrderInterface $order, Collection $collection, $taxationSettings)
 {
     $collection->isEmpty()->willReturn(false);
     $order->getItems()->willReturn($collection);
     $order->removeTaxAdjustments()->shouldBeCalled();
     $order->getShippingAddress()->willReturn(null);
     $taxationSettings->has('default_tax_zone')->willReturn(false);
     $order->addAdjustment(Argument::any())->shouldNotBeCalled();
     $this->applyTaxes($order);
 }
开发者ID:bcremer,项目名称:Sylius,代码行数:10,代码来源:TaxationProcessorSpec.php

示例8: setTags

 /**
  * Set tags
  *
  * @param Collection $tags Tags
  *
  * @return Product self Object
  */
 public function setTags(Collection $tags)
 {
     $this->tags->clear();
     if (!$tags->isEmpty()) {
         foreach ($tags as $tag) {
             $this->addTag($tag);
         }
     }
     return $this;
 }
开发者ID:bamper,项目名称:symfony-ecommerce,代码行数:17,代码来源:Product.php

示例9: isVariationUnique

 /**
  * @param AntiMattr\Common\Product\VariationInterface
  *
  * @return bool
  */
 public function isVariationUnique(VariationInterface $variation)
 {
     if ($this->variations->isEmpty()) {
         return true;
     }
     return $this->variations->forAll(function ($key, $element) use($variation) {
         if ($variation->getUniqueIdentifier() === $element->getUniqueIdentifier() && $variation !== $element) {
             return false;
         }
         return true;
     });
 }
开发者ID:antimattr,项目名称:common-product,代码行数:17,代码来源:Product.php

示例10: getUniqueIdentifier

 /**
  * A Variation is uniquely identified by the combination of Variation::options
  *
  * @return string
  */
 public function getUniqueIdentifier()
 {
     if ($this->options->isEmpty()) {
         return;
     }
     $keys = array();
     foreach ($this->options as $option) {
         $keys[] = $option->getUniqueIdentifier();
     }
     sort($keys);
     return implode("_", $keys);
 }
开发者ID:antimattr,项目名称:common-product,代码行数:17,代码来源:Variation.php

示例11: getLastShipment

 /**
  * Gets the last updated shipment of the order
  *
  * @return false|ShipmentInterface
  */
 public function getLastShipment()
 {
     if ($this->shipments->isEmpty()) {
         return false;
     }
     $last = $this->shipments->first();
     foreach ($this->shipments as $shipment) {
         if ($shipment->getUpdatedAt() > $last->getUpdatedAt()) {
             $last = $shipment;
         }
     }
     return $last;
 }
开发者ID:vikey89,项目名称:Sylius,代码行数:18,代码来源:Order.php

示例12: invoke

 /**
  * @param ConsumerContainer $consumerContainer
  * @param AMQPMessage $message
  *
  * @throws ConsumerContainerException
  * @return mixed|null
  */
 private function invoke(ConsumerContainer $consumerContainer, AMQPMessage $message)
 {
     $payload = $this->serializer->deserialize($message->body, $consumerContainer->getMessageClass(), 'json');
     try {
         $result = $consumerContainer->invoke($payload);
     } catch (Exception $e) {
         $containerException = new ConsumerContainerException($consumerContainer, $message, $payload, $e);
         if ($this->errorHandlers->isEmpty()) {
             throw $containerException;
         }
         $this->errorHandlers->map(function (ErrorHandlerInterface $handler) use($containerException) {
             $handler->handle($containerException);
         });
         return null;
     }
     return $result;
 }
开发者ID:rebuy-de,项目名称:amqp-php-consumer,代码行数:24,代码来源:ConsumerManager.php

示例13: isEmpty

 /**
  * {@inheritdoc}
  */
 public function isEmpty()
 {
     return $this->coll->isEmpty() && $this->count() === 0;
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:7,代码来源:PersistentCollection.php

示例14: isEmpty

 /**
  * Checks whether the collection is empty (contains no elements).
  *
  * @return boolean TRUE if the collection is empty, FALSE otherwise.
  */
 function isEmpty()
 {
     $this->initialize();
     return $this->collection->isEmpty();
 }
开发者ID:activelamp,项目名称:taxonomy,代码行数:10,代码来源:PluralVocabularyField.php

示例15: isEmpty

 /**
  * {@inheritdoc}
  */
 public function isEmpty()
 {
     return $this->items->isEmpty();
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:7,代码来源:Order.php


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