1 | <?php |
||
10 | abstract class BaseService |
||
11 | { |
||
12 | const USER_NOT_FOUND = 'El usuario solicitado no existe.'; |
||
13 | const USER_NAME_NOT_FOUND = 'No se encontraron usuarios con ese nombre.'; |
||
14 | const USER_NAME_REQUIRED = 'Ingrese el nombre del usuario.'; |
||
15 | const USER_INFO_REQUIRED = 'Ingrese los datos a actualizar del usuario.'; |
||
16 | const USER_DELETED = 'El usuario fue eliminado correctamente.'; |
||
17 | const USER_NAME_INVALID = 'El nombre ingresado es incorrecto.'; |
||
18 | const USER_EMAIL_INVALID = 'El email ingresado es incorrecto.'; |
||
19 | |||
20 | const TASK_NOT_FOUND = 'La tarea solicitada no existe.'; |
||
21 | const TASK_NAME_NOT_FOUND = 'No se encontraron tareas con ese nombre.'; |
||
22 | const TASK_NAME_REQUIRED = 'Ingrese el nombre de la tarea.'; |
||
23 | const TASK_INFO_REQUIRED = 'Ingrese los datos a actualizar de la tarea.'; |
||
24 | const TASK_DELETED = 'La tarea fue eliminada correctamente.'; |
||
25 | const TASK_STATUS_INVALID = 'El estado ingresado es incorrecto.'; |
||
26 | |||
27 | protected $logger; |
||
28 | protected $database; |
||
29 | protected $request; |
||
30 | protected $response; |
||
31 | protected $args; |
||
32 | |||
33 | /** |
||
34 | * Validate and sanitize input data when create new user. |
||
35 | * |
||
36 | * @param array $input |
||
37 | * @return string |
||
38 | * @throws \Exception |
||
39 | */ |
||
40 | protected function validateInputOnCreateUser($input) |
||
53 | |||
54 | /** |
||
55 | * Validate and sanitize input data when update a user. |
||
56 | * |
||
57 | * @param array $input |
||
58 | * @param object $user |
||
59 | * @return string |
||
60 | * @throws \Exception |
||
61 | */ |
||
62 | protected function validateInputOnUpdateUser($input, $user) |
||
78 | |||
79 | /** |
||
80 | * Validate and sanitize a username. |
||
81 | * |
||
82 | * @param string $name |
||
83 | * @return string |
||
84 | * @throws \Exception |
||
85 | */ |
||
86 | protected function validateName($name) |
||
94 | |||
95 | /** |
||
96 | * Validate and sanitize a email address. |
||
97 | * |
||
98 | * @param string $emailValue |
||
99 | * @return string |
||
100 | * @throws \Exception |
||
101 | */ |
||
102 | protected function validateEmail($emailValue) |
||
111 | } |
||
112 |