本文整理汇总了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;
}
示例2: getTransformations
/**
* @return \Doctrine\Common\Collections\Collection
*/
public function getTransformations()
{
if ($this->transformations->isEmpty()) {
$this->initialize();
}
return $this->transformations;
}
示例3: testClear
public function testClear()
{
$this->_coll[] = 'one';
$this->_coll[] = 'two';
$this->_coll->clear();
$this->assertEquals($this->_coll->isEmpty(), true);
}
示例4: getImage
/**
* {@inheritdoc}
*/
public function getImage()
{
if ($this->images->isEmpty()) {
return null;
}
return $this->images->first();
}
示例5: getImage
/**
* {@inheritdoc}
*/
public function getImage()
{
if ($this->images->isEmpty()) {
return $this->getProduct()->getImage();
}
return $this->images->first();
}
示例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());
}
示例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);
}
示例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;
}
示例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;
});
}
示例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);
}
示例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;
}
示例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;
}
示例13: isEmpty
/**
* {@inheritdoc}
*/
public function isEmpty()
{
return $this->coll->isEmpty() && $this->count() === 0;
}
示例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();
}
示例15: isEmpty
/**
* {@inheritdoc}
*/
public function isEmpty()
{
return $this->items->isEmpty();
}