示例#1
0
 public function __toString()
 {
     $items = $this->items->getArrayCopy();
     $itemStrings = array_map(function (Item $item) {
         return $item->__toString() . "\n";
     }, $items);
     return implode($itemStrings);
 }
示例#2
0
 /**
  * @return Collection|Item[]
  */
 public function getItems()
 {
     return $this->items->sortBy(function (Item $item) {
         return $item->getWeight();
     });
 }
 /**
  * Remove item
  *
  * @param Item $item Item
  *
  * @return $this
  */
 public function removeItem(Item $item)
 {
     $this->items->removeElement($item);
     return $this;
 }
示例#4
0
文件: Project.php 项目: gbelmm/ACL
 /**
  * @return Item[]
  */
 public function getItems()
 {
     return $this->items->toArray();
 }
 public function testNearestUseBy()
 {
     $oneMinLater = strtotime('+1 minute');
     $this->items['bread']->setUseBy($oneMinLater);
     $this->assertEquals($oneMinLater, $this->items->getNearestUseBy());
 }
示例#6
0
 /**
  * Offset to unset
  * @link  http://php.net/manual/en/arrayaccess.offsetunset.php
  *
  * @param mixed $offset <p>
  *                      The offset to unset.
  *                      </p>
  *
  * @return void
  * @since 5.0.0
  */
 public function offsetUnset($offset)
 {
     $this->items->forget($offset);
 }