當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。