1717 * @license MIT
1818 * @link https://github.com/chriskacerguis/codeigniter-restserver
1919 */
20- class Key extends REST_Controller {
20+ class Key extends \ Restserver \ Libraries \ REST_Controller {
2121
2222 protected $ methods = [
2323 'index_put ' => ['level ' => 10 , 'limit ' => 10 ],
@@ -47,14 +47,14 @@ public function index_put()
4747 $ this ->response ([
4848 'status ' => TRUE ,
4949 'key ' => $ key
50- ], REST_Controller::HTTP_CREATED ); // CREATED (201) being the HTTP response code
50+ ], \ Restserver \ Libraries \ REST_Controller::HTTP_CREATED ); // CREATED (201) being the HTTP response code
5151 }
5252 else
5353 {
5454 $ this ->response ([
5555 'status ' => FALSE ,
5656 'message ' => 'Could not save the key '
57- ], REST_Controller::HTTP_INTERNAL_SERVER_ERROR ); // INTERNAL_SERVER_ERROR (500) being the HTTP response code
57+ ], \ Restserver \ Libraries \ REST_Controller::HTTP_INTERNAL_SERVER_ERROR ); // INTERNAL_SERVER_ERROR (500) being the HTTP response code
5858 }
5959 }
6060
@@ -75,7 +75,7 @@ public function index_delete()
7575 $ this ->response ([
7676 'status ' => FALSE ,
7777 'message ' => 'Invalid API key '
78- ], REST_Controller::HTTP_BAD_REQUEST ); // BAD_REQUEST (400) being the HTTP response code
78+ ], \ Restserver \ Libraries \ REST_Controller::HTTP_BAD_REQUEST ); // BAD_REQUEST (400) being the HTTP response code
7979 }
8080
8181 // Destroy it
@@ -85,7 +85,7 @@ public function index_delete()
8585 $ this ->response ([
8686 'status ' => TRUE ,
8787 'message ' => 'API key was deleted '
88- ], REST_Controller::HTTP_NO_CONTENT ); // NO_CONTENT (204) being the HTTP response code
88+ ], \ Restserver \ Libraries \ REST_Controller::HTTP_NO_CONTENT ); // NO_CONTENT (204) being the HTTP response code
8989 }
9090
9191 /**
@@ -106,7 +106,7 @@ public function level_post()
106106 $ this ->response ([
107107 'status ' => FALSE ,
108108 'message ' => 'Invalid API key '
109- ], REST_Controller::HTTP_BAD_REQUEST ); // BAD_REQUEST (400) being the HTTP response code
109+ ], \ Restserver \ Libraries \ REST_Controller::HTTP_BAD_REQUEST ); // BAD_REQUEST (400) being the HTTP response code
110110 }
111111
112112 // Update the key level
@@ -115,14 +115,14 @@ public function level_post()
115115 $ this ->response ([
116116 'status ' => TRUE ,
117117 'message ' => 'API key was updated '
118- ], REST_Controller::HTTP_OK ); // OK (200) being the HTTP response code
118+ ], \ Restserver \ Libraries \ REST_Controller::HTTP_OK ); // OK (200) being the HTTP response code
119119 }
120120 else
121121 {
122122 $ this ->response ([
123123 'status ' => FALSE ,
124124 'message ' => 'Could not update the key level '
125- ], REST_Controller::HTTP_INTERNAL_SERVER_ERROR ); // INTERNAL_SERVER_ERROR (500) being the HTTP response code
125+ ], \ Restserver \ Libraries \ REST_Controller::HTTP_INTERNAL_SERVER_ERROR ); // INTERNAL_SERVER_ERROR (500) being the HTTP response code
126126 }
127127 }
128128
@@ -143,7 +143,7 @@ public function suspend_post()
143143 $ this ->response ([
144144 'status ' => FALSE ,
145145 'message ' => 'Invalid API key '
146- ], REST_Controller::HTTP_BAD_REQUEST ); // BAD_REQUEST (400) being the HTTP response code
146+ ], \ Restserver \ Libraries \ REST_Controller::HTTP_BAD_REQUEST ); // BAD_REQUEST (400) being the HTTP response code
147147 }
148148
149149 // Update the key level
@@ -152,14 +152,14 @@ public function suspend_post()
152152 $ this ->response ([
153153 'status ' => TRUE ,
154154 'message ' => 'Key was suspended '
155- ], REST_Controller::HTTP_OK ); // OK (200) being the HTTP response code
155+ ], \ Restserver \ Libraries \ REST_Controller::HTTP_OK ); // OK (200) being the HTTP response code
156156 }
157157 else
158158 {
159159 $ this ->response ([
160160 'status ' => FALSE ,
161161 'message ' => 'Could not suspend the user '
162- ], REST_Controller::HTTP_INTERNAL_SERVER_ERROR ); // INTERNAL_SERVER_ERROR (500) being the HTTP response code
162+ ], \ Restserver \ Libraries \ REST_Controller::HTTP_INTERNAL_SERVER_ERROR ); // INTERNAL_SERVER_ERROR (500) being the HTTP response code
163163 }
164164 }
165165
@@ -181,7 +181,7 @@ public function regenerate_post()
181181 $ this ->response ([
182182 'status ' => FALSE ,
183183 'message ' => 'Invalid API key '
184- ], REST_Controller::HTTP_BAD_REQUEST ); // BAD_REQUEST (400) being the HTTP response code
184+ ], \ Restserver \ Libraries \ REST_Controller::HTTP_BAD_REQUEST ); // BAD_REQUEST (400) being the HTTP response code
185185 }
186186
187187 // Build a new key
@@ -196,14 +196,14 @@ public function regenerate_post()
196196 $ this ->response ([
197197 'status ' => TRUE ,
198198 'key ' => $ new_key
199- ], REST_Controller::HTTP_CREATED ); // CREATED (201) being the HTTP response code
199+ ], \ Restserver \ Libraries \ REST_Controller::HTTP_CREATED ); // CREATED (201) being the HTTP response code
200200 }
201201 else
202202 {
203203 $ this ->response ([
204204 'status ' => FALSE ,
205205 'message ' => 'Could not save the key '
206- ], REST_Controller::HTTP_INTERNAL_SERVER_ERROR ); // INTERNAL_SERVER_ERROR (500) being the HTTP response code
206+ ], \ Restserver \ Libraries \ REST_Controller::HTTP_INTERNAL_SERVER_ERROR ); // INTERNAL_SERVER_ERROR (500) being the HTTP response code
207207 }
208208 }
209209
0 commit comments