for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Del\Collection;
use Del\Entity\User as UserEntity;
use Doctrine\Common\Collections\ArrayCollection;
use LogicException;
class User extends ArrayCollection
{
/**
* @param UserEntity $user
* @return $this
*/
public function update(UserEntity $user)
$key = $this->findKey($user);
if($key) {
$this->offsetSet($key,$user);
return $this;
}
throw new LogicException('User was not in the collection.');
public function append(UserEntity $user)
$this->add($user);
* @return UserEntity|null
public function current()
return parent::current();
* @return bool|int
public function findKey(UserEntity $user)
$it = $this->getIterator();
$it->rewind();
while($it->valid()) {
if($it->current()->getId() == $user->getId()) {
return $it->key();
return $it->key()
string
boolean|integer
$it->next();
return false;
public function findById($id)
if($it->current()->getId() == $id) {
return $it->current();