| @@ 47-58 (lines=12) @@ | ||
| 44 | * @param UserEntity $user |
|
| 45 | * @return bool|int |
|
| 46 | */ |
|
| 47 | public function findKey(UserEntity $user) |
|
| 48 | { |
|
| 49 | $it = $this->getIterator(); |
|
| 50 | $it->rewind(); |
|
| 51 | while($it->valid()) { |
|
| 52 | if($it->current()->getId() == $user->getId()) { |
|
| 53 | return $it->key(); |
|
| 54 | } |
|
| 55 | $it->next(); |
|
| 56 | } |
|
| 57 | return false; |
|
| 58 | } |
|
| 59 | ||
| 60 | ||
| 61 | ||
| @@ 62-74 (lines=13) @@ | ||
| 59 | ||
| 60 | ||
| 61 | ||
| 62 | public function findById($id) |
|
| 63 | { |
|
| 64 | $it = $this->getIterator(); |
|
| 65 | $it->rewind(); |
|
| 66 | while($it->valid()) { |
|
| 67 | if($it->current()->getId() == $id) { |
|
| 68 | return $it->current(); |
|
| 69 | } |
|
| 70 | $it->next(); |
|
| 71 | } |
|
| 72 | ||
| 73 | return false; |
|
| 74 | } |
|
| 75 | ||
| 76 | } |
|