1 | <?php namespace Anomaly\UsersModule\User; |
||
15 | class UserRepository extends EntryRepository implements UserRepositoryInterface |
||
16 | { |
||
17 | |||
18 | /** |
||
19 | * The user model. |
||
20 | * |
||
21 | * @var UserModel |
||
22 | */ |
||
23 | protected $model; |
||
24 | |||
25 | /** |
||
26 | * Create a new UserRepository instance. |
||
27 | * |
||
28 | * @param UserModel $model |
||
29 | */ |
||
30 | function __construct(UserModel $model) |
||
34 | |||
35 | /** |
||
36 | * Find a user by their credentials. |
||
37 | * |
||
38 | * @param array $credentials |
||
39 | * @return null|UserInterface |
||
40 | */ |
||
41 | public function findByCredentials(array $credentials) |
||
57 | |||
58 | /** |
||
59 | * Find a user by their email. |
||
60 | * |
||
61 | * @param $email |
||
62 | * @return null|UserInterface |
||
63 | */ |
||
64 | public function findByEmail($email) |
||
68 | |||
69 | /** |
||
70 | * Find a user by their username. |
||
71 | * |
||
72 | * @param $username |
||
73 | * @return null|UserInterface |
||
74 | */ |
||
75 | public function findByUsername($username) |
||
79 | |||
80 | /** |
||
81 | * Find a user by their reset code. |
||
82 | * |
||
83 | * @param $code |
||
84 | * @return null|UserInterface |
||
85 | */ |
||
86 | public function findByResetCode($code) |
||
90 | |||
91 | /** |
||
92 | * Find a user by their activation code. |
||
93 | * |
||
94 | * @param $code |
||
95 | * @return null|UserInterface |
||
96 | */ |
||
97 | public function findByActivationCode($code) |
||
101 | |||
102 | /** |
||
103 | * Touch a user's last activity and IP. |
||
104 | * |
||
105 | * @param UserInterface $user |
||
106 | * @return bool |
||
107 | */ |
||
108 | public function touchLastActivity(UserInterface $user) |
||
115 | |||
116 | /** |
||
117 | * Touch a user's last login. |
||
118 | * |
||
119 | * @param UserInterface $user |
||
120 | * @return bool |
||
121 | */ |
||
122 | public function touchLastLogin(UserInterface $user) |
||
128 | } |
||
129 |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.