Total Complexity | 10 |
Total Lines | 65 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | class User extends ArrayCollection |
||
10 | { |
||
11 | /** |
||
12 | * @param UserEntity $user |
||
13 | * @return $this |
||
14 | */ |
||
15 | 1 | public function update(UserEntity $user) |
|
25 | } |
||
26 | |||
27 | /** |
||
28 | * @param UserEntity $user |
||
29 | */ |
||
30 | 4 | public function append(UserEntity $user) |
|
31 | { |
||
32 | 4 | $this->add($user); |
|
33 | } |
||
34 | |||
35 | /** |
||
36 | * @return UserEntity|null |
||
37 | */ |
||
38 | 1 | public function current() |
|
39 | { |
||
40 | 1 | return parent::current(); |
|
41 | } |
||
42 | |||
43 | /** |
||
44 | * @param UserEntity $user |
||
45 | * @return bool|int |
||
46 | */ |
||
47 | 2 | public function findKey(UserEntity $user) |
|
48 | { |
||
49 | 2 | $it = $this->getIterator(); |
|
50 | 2 | $it->rewind(); |
|
51 | 2 | while($it->valid()) { |
|
52 | 2 | if($it->current()->getId() == $user->getId()) { |
|
53 | 1 | return $it->key(); |
|
54 | } |
||
55 | 2 | $it->next(); |
|
56 | } |
||
57 | 2 | return false; |
|
58 | } |
||
59 | |||
60 | |||
61 | |||
62 | 2 | public function findById($id) |
|
74 | } |
||
75 | |||
76 | } |