From ed7e40720e13bccd21f01a3723126f3e61802cd3 Mon Sep 17 00:00:00 2001 From: alext Date: Sun, 6 Nov 2016 18:30:03 +0100 Subject: [PATCH] Renamed firstname and lastname to firstName and lastName, also made some other corrections. --- doc/rest-api.md | 16 ++++++++-------- src/application/controllers/Appointments.php | 2 -- src/application/controllers/Backend_api.php | 1 - src/application/controllers/api/v1/Admins.php | 2 +- .../controllers/api/v1/Appointments.php | 2 +- .../controllers/api/v1/Availabilities.php | 4 ---- src/application/controllers/api/v1/Settings.php | 1 - src/engine/Api/V1/Parsers/Admins.php | 12 ++++++------ src/engine/Api/V1/Parsers/Customers.php | 12 ++++++------ src/engine/Api/V1/Parsers/Providers.php | 12 ++++++------ src/engine/Api/V1/Parsers/Secretaries.php | 12 ++++++------ src/engine/Api/V1/Processors/Search.php | 2 +- 12 files changed, 35 insertions(+), 43 deletions(-) diff --git a/doc/rest-api.md b/doc/rest-api.md index d028b1ee..e651718e 100644 --- a/doc/rest-api.md +++ b/doc/rest-api.md @@ -158,8 +158,8 @@ You can also try the GET requests with your browser by navigating to the respect ``` { "id": 97, - "firstname": "John", - "lastname": "Doe", + "firstName": "John", + "lastName": "Doe", "email": "john@doe.com", "phone": "0123456789", "address": "Some Str. 123", @@ -223,8 +223,8 @@ You can also try the GET requests with your browser by navigating to the respect ``` { "id": 143, - "firstname": "Chris", - "lastname": "Doe", + "firstName": "Chris", + "lastName": "Doe", "email": "chris@doe.com", "mobile": "012345679-0", "phone": "0123456789-1", @@ -253,8 +253,8 @@ You can also try the GET requests with your browser by navigating to the respect ``` { "id": 143, - "firstname": "Chloe", - "lastname": "Doe", + "firstName": "Chloe", + "lastName": "Doe", "email": "chloe@doe.com", "mobile": "012345679-0", "phone": "0123456789-1", @@ -338,8 +338,8 @@ You can also try the GET requests with your browser by navigating to the respect ``` { "id": 143, - "firstname": "Chris", - "lastname": "Doe", + "firstName": "Chris", + "lastName": "Doe", "email": "chris@doe.com", "mobile": "012345679-0", "phone": "0123456789-1", diff --git a/src/application/controllers/Appointments.php b/src/application/controllers/Appointments.php index 04700fec..cc37605b 100755 --- a/src/application/controllers/Appointments.php +++ b/src/application/controllers/Appointments.php @@ -872,8 +872,6 @@ class Appointments extends CI_Controller { 'id_services = ' . $this->db->escape($service_id) . ' AND DATE(start_datetime) = DATE(' . $this->db->escape(date('Y-m-d', strtotime($selected_date))) . ')'); - $hours = []; - foreach($appointments as $appointment) { $hour = date('H:i', strtotime($appointment['start_datetime'])); $current_attendants_number = $this->appointments_model->appointment_count_for_hour($service_id, diff --git a/src/application/controllers/Backend_api.php b/src/application/controllers/Backend_api.php index df45d372..0a744daf 100644 --- a/src/application/controllers/Backend_api.php +++ b/src/application/controllers/Backend_api.php @@ -11,7 +11,6 @@ * @since v1.0.0 * ---------------------------------------------------------------------------- */ -use \EA\Engine\Types\Decimal; use \EA\Engine\Types\Alphanumeric; use \EA\Engine\Types\Email; use \EA\Engine\Types\Url; diff --git a/src/application/controllers/api/v1/Admins.php b/src/application/controllers/api/v1/Admins.php index 95eb971f..35a46809 100644 --- a/src/application/controllers/api/v1/Admins.php +++ b/src/application/controllers/api/v1/Admins.php @@ -132,7 +132,7 @@ class Admins extends API_V1_Controller { */ public function delete($id) { try { - $result = $this->admins_model->delete($id); + $this->admins_model->delete($id); $response = new Response([ 'code' => 200, diff --git a/src/application/controllers/api/v1/Appointments.php b/src/application/controllers/api/v1/Appointments.php index f5f1ad3c..d6c1ec53 100644 --- a/src/application/controllers/api/v1/Appointments.php +++ b/src/application/controllers/api/v1/Appointments.php @@ -132,7 +132,7 @@ class Appointments extends API_V1_Controller { */ public function delete($id) { try { - $result = $this->appointments_model->delete($id); + $this->appointments_model->delete($id); $response = new Response([ 'code' => 200, diff --git a/src/application/controllers/api/v1/Availabilities.php b/src/application/controllers/api/v1/Availabilities.php index 7370c488..2c319edd 100644 --- a/src/application/controllers/api/v1/Availabilities.php +++ b/src/application/controllers/api/v1/Availabilities.php @@ -14,8 +14,6 @@ require_once __DIR__ . '/API_V1_Controller.php'; require_once __DIR__ . '/../../Appointments.php'; -use \EA\Engine\Api\V1\Response; -use \EA\Engine\Api\V1\Request; use \EA\Engine\Types\UnsignedInteger; /** @@ -301,8 +299,6 @@ class Availabilities extends API_V1_Controller { 'id_services = ' . $this->db->escape($service_id) . ' AND DATE(start_datetime) = DATE(' . $this->db->escape(date('Y-m-d', strtotime($selected_date))) . ')'); - $hours = []; - foreach($appointments as $appointment) { $hour = date('H:i', strtotime($appointment['start_datetime'])); $current_attendants_number = $this->appointments_model->appointment_count_for_hour($service_id, diff --git a/src/application/controllers/api/v1/Settings.php b/src/application/controllers/api/v1/Settings.php index 9c4a4fa8..61418b38 100644 --- a/src/application/controllers/api/v1/Settings.php +++ b/src/application/controllers/api/v1/Settings.php @@ -15,7 +15,6 @@ require_once __DIR__ . '/API_V1_Controller.php'; use \EA\Engine\Api\V1\Response; use \EA\Engine\Api\V1\Request; -use \EA\Engine\Types\NonEmptyAlphanumeric; /** * Settings Controller diff --git a/src/engine/Api/V1/Parsers/Admins.php b/src/engine/Api/V1/Parsers/Admins.php index 23a7549d..becab149 100644 --- a/src/engine/Api/V1/Parsers/Admins.php +++ b/src/engine/Api/V1/Parsers/Admins.php @@ -27,8 +27,8 @@ class Admins implements ParsersInterface { public function encode(array &$response) { $encodedResponse = [ 'id' => $response['id'] !== null ? (int)$response['id'] : null, - 'firstname' => $response['first_name'], - 'lastname' => $response['last_name'], + 'firstName' => $response['first_name'], + 'lastName' => $response['last_name'], 'email' => $response['email'], 'mobile' => $response['mobile_number'], 'phone' => $response['phone_number'], @@ -60,12 +60,12 @@ class Admins implements ParsersInterface { $decodedRequest['id'] = $request['id']; } - if (!empty($request['firstname'])) { - $decodedRequest['first_name'] = $request['firstname']; + if (!empty($request['firstName'])) { + $decodedRequest['first_name'] = $request['firstName']; } - if (!empty($request['lastname'])) { - $decodedRequest['last_name'] = $request['lastname']; + if (!empty($request['lastName'])) { + $decodedRequest['last_name'] = $request['lastName']; } if (!empty($request['email'])) { diff --git a/src/engine/Api/V1/Parsers/Customers.php b/src/engine/Api/V1/Parsers/Customers.php index 648b6054..43e80276 100644 --- a/src/engine/Api/V1/Parsers/Customers.php +++ b/src/engine/Api/V1/Parsers/Customers.php @@ -27,8 +27,8 @@ class Customers implements ParsersInterface { public function encode(array &$response) { $encodedResponse = [ 'id' => $response['id'] !== null ? (int)$response['id'] : null, - 'firstname' => $response['first_name'], - 'lastname' => $response['last_name'], + 'firstName' => $response['first_name'], + 'lastName' => $response['last_name'], 'email' => $response['email'], 'phone' => $response['phone_number'], 'address' => $response['address'], @@ -53,12 +53,12 @@ class Customers implements ParsersInterface { $decodedRequest['id'] = $request['id']; } - if (!empty($request['firstname'])) { - $decodedRequest['first_name'] = $request['firstname']; + if (!empty($request['firstName'])) { + $decodedRequest['first_name'] = $request['firstName']; } - if (!empty($request['lastname'])) { - $decodedRequest['last_name'] = $request['lastname']; + if (!empty($request['lastName'])) { + $decodedRequest['last_name'] = $request['lastName']; } if (!empty($request['email'])) { diff --git a/src/engine/Api/V1/Parsers/Providers.php b/src/engine/Api/V1/Parsers/Providers.php index 13819aea..45e3d89b 100644 --- a/src/engine/Api/V1/Parsers/Providers.php +++ b/src/engine/Api/V1/Parsers/Providers.php @@ -27,8 +27,8 @@ class Providers implements ParsersInterface { public function encode(array &$response) { $encodedResponse = [ 'id' => $response['id'] !== null ? (int)$response['id'] : null, - 'firstname' => $response['first_name'], - 'lastname' => $response['last_name'], + 'firstName' => $response['first_name'], + 'lastName' => $response['last_name'], 'email' => $response['email'], 'mobile' => $response['mobile_number'], 'phone' => $response['phone_number'], @@ -67,12 +67,12 @@ class Providers implements ParsersInterface { $decodedRequest['id'] = $request['id']; } - if (!empty($request['firstname'])) { - $decodedRequest['first_name'] = $request['firstname']; + if (!empty($request['firstName'])) { + $decodedRequest['first_name'] = $request['firstName']; } - if (!empty($request['lastname'])) { - $decodedRequest['last_name'] = $request['lastname']; + if (!empty($request['lastName'])) { + $decodedRequest['last_name'] = $request['lastName']; } if (!empty($request['email'])) { diff --git a/src/engine/Api/V1/Parsers/Secretaries.php b/src/engine/Api/V1/Parsers/Secretaries.php index 6b200f24..077421d8 100644 --- a/src/engine/Api/V1/Parsers/Secretaries.php +++ b/src/engine/Api/V1/Parsers/Secretaries.php @@ -27,8 +27,8 @@ class Secretaries implements ParsersInterface { public function encode(array &$response) { $encodedResponse = [ 'id' => $response['id'] !== null ? (int)$response['id'] : null, - 'firstname' => $response['first_name'], - 'lastname' => $response['last_name'], + 'firstName' => $response['first_name'], + 'lastName' => $response['last_name'], 'email' => $response['email'], 'mobile' => $response['mobile_number'], 'phone' => $response['phone_number'], @@ -61,12 +61,12 @@ class Secretaries implements ParsersInterface { $decodedRequest['id'] = $request['id']; } - if (!empty($request['firstname'])) { - $decodedRequest['first_name'] = $request['firstname']; + if (!empty($request['firstName'])) { + $decodedRequest['first_name'] = $request['firstName']; } - if (!empty($request['lastname'])) { - $decodedRequest['last_name'] = $request['lastname']; + if (!empty($request['lastName'])) { + $decodedRequest['last_name'] = $request['lastName']; } if (!empty($request['email'])) { diff --git a/src/engine/Api/V1/Processors/Search.php b/src/engine/Api/V1/Processors/Search.php index cb83753f..024a4760 100644 --- a/src/engine/Api/V1/Processors/Search.php +++ b/src/engine/Api/V1/Processors/Search.php @@ -49,7 +49,7 @@ class Search implements ProcessorsInterface { * @param array $haystack Array to search in. * @param string $needle Keyword to be searched. * - * @return int|bool Returns the index of the search occurence or false it nothing was found. + * @return int|bool Returns the index of the search occurrence or false it nothing was found. */ protected static function _recursiveArraySearch(array $haystack, $needle) { foreach ($haystack as $key => $value) {