@@ 7-25 (lines=19) @@ | ||
4 | ||
5 | use Exception; |
|
6 | ||
7 | class AcceptFriendFailed extends Exception |
|
8 | { |
|
9 | public function __construct(string $status) { |
|
10 | switch ($status) { |
|
11 | case 'SAME_USER': |
|
12 | $this->message = 'user can not accept friend request from himself'; |
|
13 | break; |
|
14 | case 'WAITING': |
|
15 | $this->message = 'user can not accept a friend request he sent'; |
|
16 | break; |
|
17 | case 'NOT_FRIENDS': |
|
18 | $this->message = 'user has no pending friend request from this user'; |
|
19 | break; |
|
20 | case 'FRIENDS': |
|
21 | $this->message = 'users are already friends'; |
|
22 | break; |
|
23 | } |
|
24 | } |
|
25 | } |
|
26 |
@@ 7-25 (lines=19) @@ | ||
4 | ||
5 | use Exception; |
|
6 | ||
7 | class AddFriendFailed extends Exception |
|
8 | { |
|
9 | public function __construct(string $status) { |
|
10 | switch ($status) { |
|
11 | case 'SAME_USER': |
|
12 | $this->message = 'user can not add himself as a friend'; |
|
13 | break; |
|
14 | case 'WAITING': |
|
15 | $this->message = 'user already sent a friend request to this user'; |
|
16 | break; |
|
17 | case 'PENDING': |
|
18 | $this->message = 'user has a pending friend request from this user'; |
|
19 | break; |
|
20 | case 'FRIENDS': |
|
21 | $this->message = 'users are already friends'; |
|
22 | break; |
|
23 | } |
|
24 | } |
|
25 | } |
|
26 |