From 46d604f5e6a9dc9c48503bd92bca970e4336a8f1 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Mon, 16 Nov 2020 11:54:59 +0200 Subject: [PATCH] Applied consistent code style to the engine class files. --- application/controllers/Backend_api.php | 8 +-- application/controllers/User.php | 2 +- .../controllers/api/v1/API_V1_Controller.php | 2 +- application/controllers/api/v1/Admins.php | 4 +- .../controllers/api/v1/Appointments.php | 4 +- application/controllers/api/v1/Categories.php | 4 +- application/controllers/api/v1/Customers.php | 4 +- application/controllers/api/v1/Providers.php | 4 +- .../controllers/api/v1/Secretaries.php | 4 +- application/controllers/api/v1/Services.php | 4 +- application/controllers/api/v1/Settings.php | 2 +- .../controllers/api/v1/Unavailabilities.php | 4 +- application/libraries/Notifications.php | 16 ++--- application/models/Services_model.php | 4 +- engine/Api/V1/Authorization.php | 18 +++--- engine/Api/V1/Exception.php | 2 +- engine/Api/V1/Parsers/Admins.php | 42 ++++++------- engine/Api/V1/Parsers/Appointments.php | 50 +++++++-------- engine/Api/V1/Parsers/Categories.php | 14 ++--- engine/Api/V1/Parsers/Customers.php | 26 ++++---- engine/Api/V1/Parsers/Providers.php | 62 +++++++++---------- engine/Api/V1/Parsers/Secretaries.php | 44 ++++++------- engine/Api/V1/Parsers/Services.php | 28 ++++----- engine/Api/V1/Parsers/Settings.php | 12 ++-- engine/Api/V1/Parsers/Unavailabilities.php | 4 +- engine/Api/V1/Processors/Minimize.php | 10 +-- engine/Api/V1/Processors/Paginate.php | 2 +- engine/Api/V1/Processors/Search.php | 12 ++-- engine/Api/V1/Processors/Sort.php | 36 +++++------ engine/Api/V1/Request.php | 2 +- engine/Notifications/Email.php | 34 +++++----- engine/Types/Boolean.php | 2 +- engine/Types/Decimal.php | 2 +- engine/Types/Email.php | 8 ++- engine/Types/Integer.php | 2 +- engine/Types/NonEmptyText.php | 4 +- engine/Types/Text.php | 6 +- engine/Types/Type.php | 4 +- engine/Types/UnsignedInteger.php | 4 +- engine/Types/Url.php | 4 +- 40 files changed, 257 insertions(+), 243 deletions(-) diff --git a/application/controllers/Backend_api.php b/application/controllers/Backend_api.php index 491c297a..d12cdd1d 100755 --- a/application/controllers/Backend_api.php +++ b/application/controllers/Backend_api.php @@ -431,7 +431,7 @@ class Backend_api extends EA_Controller { if ((bool)$send_provider === TRUE) { - $email->sendDeleteAppointment($appointment, $provider, + $email->send_delete_appointment($appointment, $provider, $service, $customer, $settings, new Email($provider['email']), new Text($this->input->post('delete_reason'))); } @@ -440,7 +440,7 @@ class Backend_api extends EA_Controller { if ((bool)$send_customer === TRUE) { - $email->sendDeleteAppointment($appointment, $provider, + $email->send_delete_appointment($appointment, $provider, $service, $customer, $settings, new Email($customer['email']), new Text($this->input->post('delete_reason'))); } @@ -455,7 +455,7 @@ class Backend_api extends EA_Controller { continue; } - $email->sendDeleteAppointment($appointment, $provider, + $email->send_delete_appointment($appointment, $provider, $service, $customer, $settings, new Email($admin['email']), new Text($this->input->post('cancel_reason'))); } @@ -475,7 +475,7 @@ class Backend_api extends EA_Controller { continue; } - $email->sendDeleteAppointment($appointment, $provider, + $email->send_delete_appointment($appointment, $provider, $service, $customer, $settings, new Email($secretary['email']), new Text($this->input->post('cancel_reason'))); } diff --git a/application/controllers/User.php b/application/controllers/User.php index 54d1c24d..6895f5a4 100644 --- a/application/controllers/User.php +++ b/application/controllers/User.php @@ -204,7 +204,7 @@ class User extends EA_Controller { 'company_email' => $this->settings_model->get_setting('company_email') ]; - $email->sendPassword(new NonEmptyText($new_password), new Email($this->input->post('email')), + $email->send_password(new NonEmptyText($new_password), new Email($this->input->post('email')), $company_settings); } diff --git a/application/controllers/api/v1/API_V1_Controller.php b/application/controllers/api/v1/API_V1_Controller.php index a46d3b13..f242d44f 100644 --- a/application/controllers/api/v1/API_V1_Controller.php +++ b/application/controllers/api/v1/API_V1_Controller.php @@ -150,7 +150,7 @@ class API_V1_Controller extends EA_Controller { ]; $header = $exception instanceof \EA\Engine\Api\V1\Exception - ? $exception->getCode() . ' ' . $exception->getHeader() + ? $exception->getCode() . ' ' . $exception->get_header() : '500 Internal Server Error'; header('HTTP/1.0 ' . $header); diff --git a/application/controllers/api/v1/Admins.php b/application/controllers/api/v1/Admins.php index 48eb71c9..c67c4aff 100644 --- a/application/controllers/api/v1/Admins.php +++ b/application/controllers/api/v1/Admins.php @@ -83,7 +83,7 @@ class Admins extends API_V1_Controller { { // Insert the admin to the database. $request = new Request(); - $admin = $request->getBody(); + $admin = $request->get_body(); $this->parser->decode($admin); if (isset($admin['id'])) @@ -123,7 +123,7 @@ class Admins extends API_V1_Controller { } $request = new Request(); - $updatedAdmin = $request->getBody(); + $updatedAdmin = $request->get_body(); $baseAdmin = $batch[0]; $this->parser->decode($updatedAdmin, $baseAdmin); $updatedAdmin['id'] = $id; diff --git a/application/controllers/api/v1/Appointments.php b/application/controllers/api/v1/Appointments.php index 4593228a..09297b54 100644 --- a/application/controllers/api/v1/Appointments.php +++ b/application/controllers/api/v1/Appointments.php @@ -97,7 +97,7 @@ class Appointments extends API_V1_Controller { { // Insert the appointment to the database. $request = new Request(); - $appointment = $request->getBody(); + $appointment = $request->get_body(); $this->parser->decode($appointment); if (isset($appointment['id'])) @@ -164,7 +164,7 @@ class Appointments extends API_V1_Controller { } $request = new Request(); - $updated_appointment = $request->getBody(); + $updated_appointment = $request->get_body(); $base_appointment = $batch[0]; $this->parser->decode($updated_appointment, $base_appointment); $updated_appointment['id'] = $id; diff --git a/application/controllers/api/v1/Categories.php b/application/controllers/api/v1/Categories.php index 5635117e..619a8851 100644 --- a/application/controllers/api/v1/Categories.php +++ b/application/controllers/api/v1/Categories.php @@ -83,7 +83,7 @@ class Categories extends API_V1_Controller { { // Insert the category to the database. $request = new Request(); - $category = $request->getBody(); + $category = $request->get_body(); $this->parser->decode($category); if (isset($category['id'])) @@ -123,7 +123,7 @@ class Categories extends API_V1_Controller { } $request = new Request(); - $updated_category = $request->getBody(); + $updated_category = $request->get_body(); $base_category = $batch[0]; $this->parser->decode($updated_category, $base_category); $updated_category['id'] = $id; diff --git a/application/controllers/api/v1/Customers.php b/application/controllers/api/v1/Customers.php index 4fdf62db..40d0464d 100644 --- a/application/controllers/api/v1/Customers.php +++ b/application/controllers/api/v1/Customers.php @@ -83,7 +83,7 @@ class Customers extends API_V1_Controller { { // Insert the customer to the database. $request = new Request(); - $customer = $request->getBody(); + $customer = $request->get_body(); $this->parser->decode($customer); if (isset($customer['id'])) @@ -123,7 +123,7 @@ class Customers extends API_V1_Controller { } $request = new Request(); - $updated_customer = $request->getBody(); + $updated_customer = $request->get_body(); $base_customer = $batch[0]; $this->parser->decode($updated_customer, $base_customer); $updated_customer['id'] = $id; diff --git a/application/controllers/api/v1/Providers.php b/application/controllers/api/v1/Providers.php index 3ada9578..68394e2a 100644 --- a/application/controllers/api/v1/Providers.php +++ b/application/controllers/api/v1/Providers.php @@ -83,7 +83,7 @@ class Providers extends API_V1_Controller { { // Insert the provider to the database. $request = new Request(); - $provider = $request->getBody(); + $provider = $request->get_body(); $this->parser->decode($provider); if (isset($provider['id'])) @@ -123,7 +123,7 @@ class Providers extends API_V1_Controller { } $request = new Request(); - $updated_provider = $request->getBody(); + $updated_provider = $request->get_body(); $base_provider = $batch[0]; $this->parser->decode($updated_provider, $base_provider); $updated_provider['id'] = $id; diff --git a/application/controllers/api/v1/Secretaries.php b/application/controllers/api/v1/Secretaries.php index 135f0651..066abec1 100644 --- a/application/controllers/api/v1/Secretaries.php +++ b/application/controllers/api/v1/Secretaries.php @@ -83,7 +83,7 @@ class Secretaries extends API_V1_Controller { { // Insert the secretary to the database. $request = new Request(); - $secretary = $request->getBody(); + $secretary = $request->get_body(); $this->parser->decode($secretary); if (isset($secretary['id'])) @@ -123,7 +123,7 @@ class Secretaries extends API_V1_Controller { } $request = new Request(); - $updated_secretary = $request->getBody(); + $updated_secretary = $request->get_body(); $base_secretary = $batch[0]; $this->parser->decode($updated_secretary, $base_secretary); $updated_secretary['id'] = $id; diff --git a/application/controllers/api/v1/Services.php b/application/controllers/api/v1/Services.php index c3011994..e2083c22 100644 --- a/application/controllers/api/v1/Services.php +++ b/application/controllers/api/v1/Services.php @@ -83,7 +83,7 @@ class Services extends API_V1_Controller { { // Insert the service to the database. $request = new Request(); - $service = $request->getBody(); + $service = $request->get_body(); $this->parser->decode($service); if (isset($service['id'])) @@ -123,7 +123,7 @@ class Services extends API_V1_Controller { } $request = new Request(); - $updated_service = $request->getBody(); + $updated_service = $request->get_body(); $base_service = $batch[0]; $this->parser->decode($updated_service, $base_service); $updated_service['id'] = $id; diff --git a/application/controllers/api/v1/Settings.php b/application/controllers/api/v1/Settings.php index 00106408..7a9732de 100644 --- a/application/controllers/api/v1/Settings.php +++ b/application/controllers/api/v1/Settings.php @@ -102,7 +102,7 @@ class Settings extends API_V1_Controller { try { $request = new Request(); - $value = $request->getBody()['value']; + $value = $request->get_body()['value']; $this->settings_model->set_setting($name, $value); // Fetch the updated object from the database and return it to the client. diff --git a/application/controllers/api/v1/Unavailabilities.php b/application/controllers/api/v1/Unavailabilities.php index e1ea1820..7ae391c7 100644 --- a/application/controllers/api/v1/Unavailabilities.php +++ b/application/controllers/api/v1/Unavailabilities.php @@ -83,7 +83,7 @@ class Unavailabilities extends API_V1_Controller { { // Insert the appointment to the database. $request = new Request(); - $unavailability = $request->getBody(); + $unavailability = $request->get_body(); $this->parser->decode($unavailability); if (isset($unavailability['id'])) @@ -123,7 +123,7 @@ class Unavailabilities extends API_V1_Controller { } $request = new Request(); - $updatedUnavailability = $request->getBody(); + $updatedUnavailability = $request->get_body(); $baseUnavailability = $batch[0]; $this->parser->decode($updatedUnavailability, $baseUnavailability); $updatedUnavailability['id'] = $id; diff --git a/application/libraries/Notifications.php b/application/libraries/Notifications.php index f7917207..2188f022 100644 --- a/application/libraries/Notifications.php +++ b/application/libraries/Notifications.php @@ -89,7 +89,7 @@ class Notifications { if ($send_customer === TRUE) { - $email->sendAppointmentDetails($appointment, $provider, + $email->send_appointment_details($appointment, $provider, $service, $customer, $settings, $customer_title, $customer_message, $customer_link, new Email($customer['email']), new Text($ics_stream), $customer['timezone']); } @@ -100,7 +100,7 @@ class Notifications { if ($send_provider === TRUE) { - $email->sendAppointmentDetails($appointment, $provider, + $email->send_appointment_details($appointment, $provider, $service, $customer, $settings, $provider_title, $provider_message, $provider_link, new Email($provider['email']), new Text($ics_stream), $provider['timezone']); } @@ -115,7 +115,7 @@ class Notifications { continue; } - $email->sendAppointmentDetails($appointment, $provider, + $email->send_appointment_details($appointment, $provider, $service, $customer, $settings, $provider_title, $provider_message, $provider_link, new Email($admin['email']), new Text($ics_stream), $admin['timezone']); } @@ -135,7 +135,7 @@ class Notifications { continue; } - $email->sendAppointmentDetails($appointment, $provider, + $email->send_appointment_details($appointment, $provider, $service, $customer, $settings, $provider_title, $provider_message, $provider_link, new Email($secretary['email']), new Text($ics_stream), $secretary['timezone']); } @@ -168,7 +168,7 @@ class Notifications { if ($send_provider === TRUE) { - $email->sendDeleteAppointment($appointment, $provider, + $email->send_delete_appointment($appointment, $provider, $service, $customer, $settings, new Email($provider['email']), new Text($this->CI->input->post('cancel_reason'))); } @@ -179,7 +179,7 @@ class Notifications { if ($send_customer === TRUE) { - $email->sendDeleteAppointment($appointment, $provider, + $email->send_delete_appointment($appointment, $provider, $service, $customer, $settings, new Email($customer['email']), new Text($this->CI->input->post('cancel_reason'))); } @@ -194,7 +194,7 @@ class Notifications { continue; } - $email->sendDeleteAppointment($appointment, $provider, + $email->send_delete_appointment($appointment, $provider, $service, $customer, $settings, new Email($admin['email']), new Text($this->CI->input->post('cancel_reason'))); } @@ -214,7 +214,7 @@ class Notifications { continue; } - $email->sendDeleteAppointment($appointment, $provider, + $email->send_delete_appointment($appointment, $provider, $service, $customer, $settings, new Email($secretary['email']), new Text($this->CI->input->post('cancel_reason'))); } diff --git a/application/models/Services_model.php b/application/models/Services_model.php index e41a2e9f..31de1865 100644 --- a/application/models/Services_model.php +++ b/application/models/Services_model.php @@ -314,7 +314,9 @@ class Services_model extends EA_Model { /** * Get all, or specific records from service's table. * - * @example $this->Model->getBatch('id = ' . $recordId); + * Example: + * + * $this->model->get_batch(['id' => $record_id]); * * @param mixed $where * @param mixed $order_by diff --git a/engine/Api/V1/Authorization.php b/engine/Api/V1/Authorization.php index 627f8309..f510ceb4 100644 --- a/engine/Api/V1/Authorization.php +++ b/engine/Api/V1/Authorization.php @@ -13,7 +13,9 @@ namespace EA\Engine\Api\V1; -use \EA\Engine\Types\NonEmptyText; +use CI_Controller; +use EA\Engine\Types\NonEmptyText; +use EA_Controller; /** * API v1 Authorization Class @@ -26,18 +28,18 @@ class Authorization { /** * Framework Instance * - * @var CI_Controller + * @var EA_Controller */ - protected $framework; + protected $CI; /** * Class Constructor * - * @param \CI_Controller $framework + * @param CI_Controller $CI */ - public function __construct(\CI_Controller $framework) + public function __construct(EA_Controller $CI) { - $this->framework = $framework; + $this->CI = $CI; } /** @@ -50,9 +52,9 @@ class Authorization { */ public function basic(NonEmptyText $username, NonEmptyText $password) { - $this->framework->load->model('user_model'); + $this->CI->load->model('user_model'); - if ( ! $this->framework->user_model->check_login($username->get(), $password->get())) + if ( ! $this->CI->user_model->check_login($username->get(), $password->get())) { throw new Exception('The provided credentials do not match any admin user!', 401, 'Unauthorized'); } diff --git a/engine/Api/V1/Exception.php b/engine/Api/V1/Exception.php index 5b7f4088..750031ca 100644 --- a/engine/Api/V1/Exception.php +++ b/engine/Api/V1/Exception.php @@ -51,7 +51,7 @@ class Exception extends \Exception { * * @return string */ - public function getHeader() + public function get_header() { return $this->header; } diff --git a/engine/Api/V1/Parsers/Admins.php b/engine/Api/V1/Parsers/Admins.php index 674571e3..e1c56b08 100644 --- a/engine/Api/V1/Parsers/Admins.php +++ b/engine/Api/V1/Parsers/Admins.php @@ -28,7 +28,7 @@ class Admins implements ParsersInterface { */ public function encode(array &$response) { - $encodedResponse = [ + $encoded_response = [ 'id' => $response['id'] !== NULL ? (int)$response['id'] : NULL, 'firstName' => $response['first_name'], 'lastName' => $response['last_name'], @@ -47,7 +47,7 @@ class Admins implements ParsersInterface { ] ]; - $response = $encodedResponse; + $response = $encoded_response; } /** @@ -58,92 +58,92 @@ class Admins implements ParsersInterface { */ public function decode(array &$request, array $base = NULL) { - $decodedRequest = $base ?: []; + $decoded_request = $base ?: []; if ( ! empty($request['id'])) { - $decodedRequest['id'] = $request['id']; + $decoded_request['id'] = $request['id']; } if ( ! empty($request['firstName'])) { - $decodedRequest['first_name'] = $request['firstName']; + $decoded_request['first_name'] = $request['firstName']; } if ( ! empty($request['lastName'])) { - $decodedRequest['last_name'] = $request['lastName']; + $decoded_request['last_name'] = $request['lastName']; } if ( ! empty($request['email'])) { - $decodedRequest['email'] = $request['email']; + $decoded_request['email'] = $request['email']; } if ( ! empty($request['mobile'])) { - $decodedRequest['mobile_number'] = $request['mobile']; + $decoded_request['mobile_number'] = $request['mobile']; } if ( ! empty($request['phone'])) { - $decodedRequest['phone_number'] = $request['phone']; + $decoded_request['phone_number'] = $request['phone']; } if ( ! empty($request['address'])) { - $decodedRequest['address'] = $request['address']; + $decoded_request['address'] = $request['address']; } if ( ! empty($request['city'])) { - $decodedRequest['city'] = $request['city']; + $decoded_request['city'] = $request['city']; } if ( ! empty($request['state'])) { - $decodedRequest['state'] = $request['state']; + $decoded_request['state'] = $request['state']; } if ( ! empty($request['zip'])) { - $decodedRequest['zip_code'] = $request['zip']; + $decoded_request['zip_code'] = $request['zip']; } if ( ! empty($request['notes'])) { - $decodedRequest['notes'] = $request['notes']; + $decoded_request['notes'] = $request['notes']; } if ( ! empty($request['settings'])) { - if (empty($decodedRequest['settings'])) + if (empty($decoded_request['settings'])) { - $decodedRequest['settings'] = []; + $decoded_request['settings'] = []; } if ( ! empty($request['settings']['username'])) { - $decodedRequest['settings']['username'] = $request['settings']['username']; + $decoded_request['settings']['username'] = $request['settings']['username']; } if ( ! empty($request['settings']['password'])) { - $decodedRequest['settings']['password'] = $request['settings']['password']; + $decoded_request['settings']['password'] = $request['settings']['password']; } if ($request['settings']['notifications'] !== NULL) { - $decodedRequest['settings']['notifications'] = filter_var($request['settings']['notifications'], + $decoded_request['settings']['notifications'] = filter_var($request['settings']['notifications'], FILTER_VALIDATE_BOOLEAN); } if ( ! empty($request['settings']['calendarView'])) { - $decodedRequest['settings']['calendar_view'] = $request['settings']['calendarView']; + $decoded_request['settings']['calendar_view'] = $request['settings']['calendarView']; } } - $request = $decodedRequest; + $request = $decoded_request; } } diff --git a/engine/Api/V1/Parsers/Appointments.php b/engine/Api/V1/Parsers/Appointments.php index 273974e8..aa90eee9 100644 --- a/engine/Api/V1/Parsers/Appointments.php +++ b/engine/Api/V1/Parsers/Appointments.php @@ -28,7 +28,7 @@ class Appointments implements ParsersInterface { */ public function encode(array &$response) { - $encodedResponse = [ + $encoded_response = [ 'id' => $response['id'] !== NULL ? (int)$response['id'] : NULL, 'book' => $response['book_datetime'], 'start' => $response['start_datetime'], @@ -44,26 +44,26 @@ class Appointments implements ParsersInterface { if (isset($response['provider'])) { - $providerParser = new Providers(); - $providerParser->encode($response['provider']); - $encodedResponse['provider'] = $response['provider']; + $provider_parser = new Providers(); + $provider_parser->encode($response['provider']); + $encoded_response['provider'] = $response['provider']; } if (isset($response['customer'])) { - $customerParser = new Customers(); - $customerParser->encode($response['customer']); - $encodedResponse['customer'] = $response['customer']; + $customer_parser = new Customers(); + $customer_parser->encode($response['customer']); + $encoded_response['customer'] = $response['customer']; } if (isset($response['service'])) { - $serviceParser = new Services(); - $serviceParser->encode($response['service']); - $encodedResponse['service'] = $response['service']; + $service_parser = new Services(); + $service_parser->encode($response['service']); + $encoded_response['service'] = $response['service']; } - $response = $encodedResponse; + $response = $encoded_response; } /** @@ -74,65 +74,65 @@ class Appointments implements ParsersInterface { */ public function decode(array &$request, array $base = NULL) { - $decodedRequest = $base ?: []; + $decoded_request = $base ?: []; if ( ! empty($request['id'])) { - $decodedRequest['id'] = $request['id']; + $decoded_request['id'] = $request['id']; } if ( ! empty($request['book'])) { - $decodedRequest['book_datetime'] = $request['book']; + $decoded_request['book_datetime'] = $request['book']; } if ( ! empty($request['start'])) { - $decodedRequest['start_datetime'] = $request['start']; + $decoded_request['start_datetime'] = $request['start']; } if ( ! empty($request['end'])) { - $decodedRequest['end_datetime'] = $request['end']; + $decoded_request['end_datetime'] = $request['end']; } if ( ! empty($request['hash'])) { - $decodedRequest['hash'] = $request['hash']; + $decoded_request['hash'] = $request['hash']; } if ( ! empty($request['location'])) { - $decodedRequest['location'] = $request['location']; + $decoded_request['location'] = $request['location']; } if ( ! empty($request['notes'])) { - $decodedRequest['notes'] = $request['notes']; + $decoded_request['notes'] = $request['notes']; } if ( ! empty($request['customerId'])) { - $decodedRequest['id_users_customer'] = $request['customerId']; + $decoded_request['id_users_customer'] = $request['customerId']; } if ( ! empty($request['providerId'])) { - $decodedRequest['id_users_provider'] = $request['providerId']; + $decoded_request['id_users_provider'] = $request['providerId']; } if ( ! empty($request['serviceId'])) { - $decodedRequest['id_services'] = $request['serviceId']; + $decoded_request['id_services'] = $request['serviceId']; } if ( ! empty($request['googleCalendarId'])) { - $decodedRequest['id_google_calendar'] = $request['googleCalendarId']; + $decoded_request['id_google_calendar'] = $request['googleCalendarId']; } - $decodedRequest['is_unavailable'] = FALSE; + $decoded_request['is_unavailable'] = FALSE; - $request = $decodedRequest; + $request = $decoded_request; } } diff --git a/engine/Api/V1/Parsers/Categories.php b/engine/Api/V1/Parsers/Categories.php index ae7a7996..c270795d 100644 --- a/engine/Api/V1/Parsers/Categories.php +++ b/engine/Api/V1/Parsers/Categories.php @@ -28,13 +28,13 @@ class Categories implements ParsersInterface { */ public function encode(array &$response) { - $encodedResponse = [ + $encoded_response = [ 'id' => $response['id'] !== NULL ? (int)$response['id'] : NULL, 'name' => $response['name'], 'description' => $response['description'] ]; - $response = $encodedResponse; + $response = $encoded_response; } /** @@ -45,23 +45,23 @@ class Categories implements ParsersInterface { */ public function decode(array &$request, array $base = NULL) { - $decodedRequest = $base ?: []; + $decoded_request = $base ?: []; if ( ! empty($request['id'])) { - $decodedRequest['id'] = $request['id']; + $decoded_request['id'] = $request['id']; } if ( ! empty($request['name'])) { - $decodedRequest['name'] = $request['name']; + $decoded_request['name'] = $request['name']; } if ( ! empty($request['description'])) { - $decodedRequest['description'] = $request['description']; + $decoded_request['description'] = $request['description']; } - $request = $decodedRequest; + $request = $decoded_request; } } diff --git a/engine/Api/V1/Parsers/Customers.php b/engine/Api/V1/Parsers/Customers.php index f1c3fb34..17df8a55 100644 --- a/engine/Api/V1/Parsers/Customers.php +++ b/engine/Api/V1/Parsers/Customers.php @@ -28,7 +28,7 @@ class Customers implements ParsersInterface { */ public function encode(array &$response) { - $encodedResponse = [ + $encoded_response = [ 'id' => $response['id'] !== NULL ? (int)$response['id'] : NULL, 'firstName' => $response['first_name'], 'lastName' => $response['last_name'], @@ -40,7 +40,7 @@ class Customers implements ParsersInterface { 'notes' => $response['notes'] ]; - $response = $encodedResponse; + $response = $encoded_response; } /** @@ -51,53 +51,53 @@ class Customers implements ParsersInterface { */ public function decode(array &$request, array $base = NULL) { - $decodedRequest = $base ?: []; + $decoded_request = $base ?: []; if ( ! empty($request['id'])) { - $decodedRequest['id'] = $request['id']; + $decoded_request['id'] = $request['id']; } if ( ! empty($request['firstName'])) { - $decodedRequest['first_name'] = $request['firstName']; + $decoded_request['first_name'] = $request['firstName']; } if ( ! empty($request['lastName'])) { - $decodedRequest['last_name'] = $request['lastName']; + $decoded_request['last_name'] = $request['lastName']; } if ( ! empty($request['email'])) { - $decodedRequest['email'] = $request['email']; + $decoded_request['email'] = $request['email']; } if ( ! empty($request['phone'])) { - $decodedRequest['phone_number'] = $request['phone']; + $decoded_request['phone_number'] = $request['phone']; } if ( ! empty($request['address'])) { - $decodedRequest['address'] = $request['address']; + $decoded_request['address'] = $request['address']; } if ( ! empty($request['city'])) { - $decodedRequest['city'] = $request['city']; + $decoded_request['city'] = $request['city']; } if ( ! empty($request['zip'])) { - $decodedRequest['zip_code'] = $request['zip']; + $decoded_request['zip_code'] = $request['zip']; } if ( ! empty($request['notes'])) { - $decodedRequest['notes'] = $request['notes']; + $decoded_request['notes'] = $request['notes']; } - $request = $decodedRequest; + $request = $decoded_request; } } diff --git a/engine/Api/V1/Parsers/Providers.php b/engine/Api/V1/Parsers/Providers.php index e0c7d946..2f8327a8 100644 --- a/engine/Api/V1/Parsers/Providers.php +++ b/engine/Api/V1/Parsers/Providers.php @@ -28,7 +28,7 @@ class Providers implements ParsersInterface { */ public function encode(array &$response) { - $encodedResponse = [ + $encoded_response = [ 'id' => $response['id'] !== NULL ? (int)$response['id'] : NULL, 'firstName' => $response['first_name'], 'lastName' => $response['last_name'], @@ -44,12 +44,12 @@ class Providers implements ParsersInterface { if (array_key_exists('services', $response)) { - $encodedResponse['services'] = $response['services']; + $encoded_response['services'] = $response['services']; } if (array_key_exists('settings', $response)) { - $encodedResponse['settings'] = [ + $encoded_response['settings'] = [ 'username' => $response['settings']['username'], 'notifications' => filter_var($response['settings']['notifications'], FILTER_VALIDATE_BOOLEAN), 'calendarView' => $response['settings']['calendar_view'], @@ -63,7 +63,7 @@ class Providers implements ParsersInterface { ]; } - $response = $encodedResponse; + $response = $encoded_response; } /** @@ -74,133 +74,133 @@ class Providers implements ParsersInterface { */ public function decode(array &$request, array $base = NULL) { - $decodedRequest = $base ?: []; + $decoded_request = $base ?: []; if ( ! empty($request['id'])) { - $decodedRequest['id'] = $request['id']; + $decoded_request['id'] = $request['id']; } if ( ! empty($request['firstName'])) { - $decodedRequest['first_name'] = $request['firstName']; + $decoded_request['first_name'] = $request['firstName']; } if ( ! empty($request['lastName'])) { - $decodedRequest['last_name'] = $request['lastName']; + $decoded_request['last_name'] = $request['lastName']; } if ( ! empty($request['email'])) { - $decodedRequest['email'] = $request['email']; + $decoded_request['email'] = $request['email']; } if ( ! empty($request['mobile'])) { - $decodedRequest['mobile_number'] = $request['mobile']; + $decoded_request['mobile_number'] = $request['mobile']; } if ( ! empty($request['phone'])) { - $decodedRequest['phone_number'] = $request['phone']; + $decoded_request['phone_number'] = $request['phone']; } if ( ! empty($request['address'])) { - $decodedRequest['address'] = $request['address']; + $decoded_request['address'] = $request['address']; } if ( ! empty($request['city'])) { - $decodedRequest['city'] = $request['city']; + $decoded_request['city'] = $request['city']; } if ( ! empty($request['state'])) { - $decodedRequest['state'] = $request['state']; + $decoded_request['state'] = $request['state']; } if ( ! empty($request['zip'])) { - $decodedRequest['zip_code'] = $request['zip']; + $decoded_request['zip_code'] = $request['zip']; } if ( ! empty($request['notes'])) { - $decodedRequest['notes'] = $request['notes']; + $decoded_request['notes'] = $request['notes']; } if ( ! empty($request['services'])) { - $decodedRequest['services'] = $request['services']; + $decoded_request['services'] = $request['services']; } if ( ! empty($request['settings'])) { - if (empty($decodedRequest['settings'])) + if (empty($decoded_request['settings'])) { - $decodedRequest['settings'] = []; + $decoded_request['settings'] = []; } if ( ! empty($request['settings']['username'])) { - $decodedRequest['settings']['username'] = $request['settings']['username']; + $decoded_request['settings']['username'] = $request['settings']['username']; } if ( ! empty($request['settings']['password'])) { - $decodedRequest['settings']['password'] = $request['settings']['password']; + $decoded_request['settings']['password'] = $request['settings']['password']; } if ( ! empty($request['settings']['calendarView'])) { - $decodedRequest['settings']['calendar_view'] = $request['settings']['calendarView']; + $decoded_request['settings']['calendar_view'] = $request['settings']['calendarView']; } if ($request['settings']['notifications'] !== NULL) { - $decodedRequest['settings']['notifications'] = filter_var($request['settings']['notifications'], + $decoded_request['settings']['notifications'] = filter_var($request['settings']['notifications'], FILTER_VALIDATE_BOOLEAN); } if ($request['settings']['googleSync'] !== NULL) { - $decodedRequest['settings']['google_sync'] = filter_var($request['settings']['googleSync'], + $decoded_request['settings']['google_sync'] = filter_var($request['settings']['googleSync'], FILTER_VALIDATE_BOOLEAN); } if ( ! empty($request['settings']['googleCalendar'])) { - $decodedRequest['settings']['google_calendar'] = $request['settings']['googleCalendar']; + $decoded_request['settings']['google_calendar'] = $request['settings']['googleCalendar']; } if ( ! empty($request['settings']['googleToken'])) { - $decodedRequest['settings']['google_token'] = $request['settings']['googleToken']; + $decoded_request['settings']['google_token'] = $request['settings']['googleToken']; } if ( ! empty($request['settings']['syncFutureDays'])) { - $decodedRequest['settings']['sync_future_days'] = $request['settings']['syncFutureDays']; + $decoded_request['settings']['sync_future_days'] = $request['settings']['syncFutureDays']; } if ( ! empty($request['settings']['syncPastDays'])) { - $decodedRequest['settings']['sync_past_days'] = $request['settings']['syncPastDays']; + $decoded_request['settings']['sync_past_days'] = $request['settings']['syncPastDays']; } if ( ! empty($request['settings']['workingPlan'])) { - $decodedRequest['settings']['working_plan'] = json_encode($request['settings']['workingPlan']); + $decoded_request['settings']['working_plan'] = json_encode($request['settings']['workingPlan']); } if ( ! empty($request['settings']['workingPlanExceptions'])) { - $decodedRequest['settings']['working_plan_exceptions'] = json_encode($request['settings']['workingPlanExceptions']); + $decoded_request['settings']['working_plan_exceptions'] = json_encode($request['settings']['workingPlanExceptions']); } } - $request = $decodedRequest; + $request = $decoded_request; } } diff --git a/engine/Api/V1/Parsers/Secretaries.php b/engine/Api/V1/Parsers/Secretaries.php index a487e10c..86bda591 100644 --- a/engine/Api/V1/Parsers/Secretaries.php +++ b/engine/Api/V1/Parsers/Secretaries.php @@ -28,7 +28,7 @@ class Secretaries implements ParsersInterface { */ public function encode(array &$response) { - $encodedResponse = [ + $encoded_response = [ 'id' => $response['id'] !== NULL ? (int)$response['id'] : NULL, 'firstName' => $response['first_name'], 'lastName' => $response['last_name'], @@ -48,7 +48,7 @@ class Secretaries implements ParsersInterface { ] ]; - $response = $encodedResponse; + $response = $encoded_response; } /** @@ -59,97 +59,97 @@ class Secretaries implements ParsersInterface { */ public function decode(array &$request, array $base = NULL) { - $decodedRequest = $base ?: []; + $decoded_request = $base ?: []; if ( ! empty($request['id'])) { - $decodedRequest['id'] = $request['id']; + $decoded_request['id'] = $request['id']; } if ( ! empty($request['firstName'])) { - $decodedRequest['first_name'] = $request['firstName']; + $decoded_request['first_name'] = $request['firstName']; } if ( ! empty($request['lastName'])) { - $decodedRequest['last_name'] = $request['lastName']; + $decoded_request['last_name'] = $request['lastName']; } if ( ! empty($request['email'])) { - $decodedRequest['email'] = $request['email']; + $decoded_request['email'] = $request['email']; } if ( ! empty($request['mobile'])) { - $decodedRequest['mobile_number'] = $request['mobile']; + $decoded_request['mobile_number'] = $request['mobile']; } if ( ! empty($request['phone'])) { - $decodedRequest['phone_number'] = $request['phone']; + $decoded_request['phone_number'] = $request['phone']; } if ( ! empty($request['address'])) { - $decodedRequest['address'] = $request['address']; + $decoded_request['address'] = $request['address']; } if ( ! empty($request['city'])) { - $decodedRequest['city'] = $request['city']; + $decoded_request['city'] = $request['city']; } if ( ! empty($request['state'])) { - $decodedRequest['state'] = $request['state']; + $decoded_request['state'] = $request['state']; } if ( ! empty($request['zip'])) { - $decodedRequest['zip_code'] = $request['zip']; + $decoded_request['zip_code'] = $request['zip']; } if ( ! empty($request['notes'])) { - $decodedRequest['notes'] = $request['notes']; + $decoded_request['notes'] = $request['notes']; } if ( ! empty($request['providers'])) { - $decodedRequest['providers'] = $request['providers']; + $decoded_request['providers'] = $request['providers']; } if ( ! empty($request['settings'])) { - if (empty($decodedRequest['settings'])) + if (empty($decoded_request['settings'])) { - $decodedRequest['settings'] = []; + $decoded_request['settings'] = []; } if ( ! empty($request['settings']['username'])) { - $decodedRequest['settings']['username'] = $request['settings']['username']; + $decoded_request['settings']['username'] = $request['settings']['username']; } if ( ! empty($request['settings']['password'])) { - $decodedRequest['settings']['password'] = $request['settings']['password']; + $decoded_request['settings']['password'] = $request['settings']['password']; } if ($request['settings']['notifications'] !== NULL) { - $decodedRequest['settings']['notifications'] = filter_var($request['settings']['notifications'], + $decoded_request['settings']['notifications'] = filter_var($request['settings']['notifications'], FILTER_VALIDATE_BOOLEAN); } if ( ! empty($request['settings']['calendarView'])) { - $decodedRequest['settings']['calendar_view'] = $request['settings']['calendarView']; + $decoded_request['settings']['calendar_view'] = $request['settings']['calendarView']; } } - $request = $decodedRequest; + $request = $decoded_request; } } diff --git a/engine/Api/V1/Parsers/Services.php b/engine/Api/V1/Parsers/Services.php index 82a40fd7..d4757084 100644 --- a/engine/Api/V1/Parsers/Services.php +++ b/engine/Api/V1/Parsers/Services.php @@ -28,7 +28,7 @@ class Services implements ParsersInterface { */ public function encode(array &$response) { - $encodedResponse = [ + $encoded_response = [ 'id' => $response['id'] !== NULL ? (int)$response['id'] : NULL, 'name' => $response['name'], 'duration' => (int)$response['duration'], @@ -41,7 +41,7 @@ class Services implements ParsersInterface { 'categoryId' => $response['id_service_categories'] !== NULL ? (int)$response['id_service_categories'] : NULL ]; - $response = $encodedResponse; + $response = $encoded_response; } /** @@ -52,58 +52,58 @@ class Services implements ParsersInterface { */ public function decode(array &$request, array $base = NULL) { - $decodedRequest = $base ?: []; + $decoded_request = $base ?: []; if ( ! empty($request['id'])) { - $decodedRequest['id'] = $request['id']; + $decoded_request['id'] = $request['id']; } if ( ! empty($request['name'])) { - $decodedRequest['name'] = $request['name']; + $decoded_request['name'] = $request['name']; } if ( ! empty($request['duration'])) { - $decodedRequest['duration'] = $request['duration']; + $decoded_request['duration'] = $request['duration']; } if ( ! empty($request['price'])) { - $decodedRequest['price'] = $request['price']; + $decoded_request['price'] = $request['price']; } if ( ! empty($request['currency'])) { - $decodedRequest['currency'] = $request['currency']; + $decoded_request['currency'] = $request['currency']; } if ( ! empty($request['description'])) { - $decodedRequest['description'] = $request['description']; + $decoded_request['description'] = $request['description']; } if ( ! empty($request['location'])) { - $decodedRequest['location'] = $request['location']; + $decoded_request['location'] = $request['location']; } if ( ! empty($request['availabilitiesType'])) { - $decodedRequest['availabilities_type'] = $request['availabilitiesType']; + $decoded_request['availabilities_type'] = $request['availabilitiesType']; } if ( ! empty($request['attendantsNumber'])) { - $decodedRequest['attendants_number'] = $request['attendantsNumber']; + $decoded_request['attendants_number'] = $request['attendantsNumber']; } if ( ! empty($request['categoryId'])) { - $decodedRequest['id_service_categories'] = $request['categoryId']; + $decoded_request['id_service_categories'] = $request['categoryId']; } - $request = $decodedRequest; + $request = $decoded_request; } } diff --git a/engine/Api/V1/Parsers/Settings.php b/engine/Api/V1/Parsers/Settings.php index ef0a713a..48a19c71 100644 --- a/engine/Api/V1/Parsers/Settings.php +++ b/engine/Api/V1/Parsers/Settings.php @@ -28,12 +28,12 @@ class Settings implements ParsersInterface { */ public function encode(array &$response) { - $encodedResponse = [ + $encoded_response = [ 'name' => $response['name'], 'value' => $response['value'] ]; - $response = $encodedResponse; + $response = $encoded_response; } /** @@ -44,18 +44,18 @@ class Settings implements ParsersInterface { */ public function decode(array &$request, array $base = NULL) { - $decodedRequest = $base ?: []; + $decoded_request = $base ?: []; if ( ! empty($request['name'])) { - $decodedRequest['name'] = $request['name']; + $decoded_request['name'] = $request['name']; } if ( ! empty($request['value'])) { - $decodedRequest['value'] = $request['value']; + $decoded_request['value'] = $request['value']; } - $request = $decodedRequest; + $request = $decoded_request; } } diff --git a/engine/Api/V1/Parsers/Unavailabilities.php b/engine/Api/V1/Parsers/Unavailabilities.php index 87b49b30..09d0b142 100644 --- a/engine/Api/V1/Parsers/Unavailabilities.php +++ b/engine/Api/V1/Parsers/Unavailabilities.php @@ -28,7 +28,7 @@ class Unavailabilities implements ParsersInterface { */ public function encode(array &$response) { - $encodedResponse = [ + $encoded_response = [ 'id' => $response['id'] !== NULL ? (int)$response['id'] : NULL, 'book' => $response['book_datetime'], 'start' => $response['start_datetime'], @@ -38,7 +38,7 @@ class Unavailabilities implements ParsersInterface { 'googleCalendarId' => $response['id_google_calendar'] !== NULL ? (int)$response['id_google_calendar'] : NULL ]; - $response = $encodedResponse; + $response = $encoded_response; } /** diff --git a/engine/Api/V1/Processors/Minimize.php b/engine/Api/V1/Processors/Minimize.php index 63631219..3292ea36 100644 --- a/engine/Api/V1/Processors/Minimize.php +++ b/engine/Api/V1/Processors/Minimize.php @@ -44,24 +44,24 @@ class Minimize implements ProcessorsInterface { $fields = explode(',', $_GET['fields']); - $temporaryResponse = []; + $temporary_response = []; foreach ($response as &$entry) { - $temporaryEntry = []; + $temporary_entry = []; foreach ($fields as $field) { $field = trim($field); if (isset($entry[$field])) { - $temporaryEntry[$field] = $entry[$field]; + $temporary_entry[$field] = $entry[$field]; } } - $temporaryResponse[] = $temporaryEntry; + $temporary_response[] = $temporary_entry; } - $response = $temporaryResponse; + $response = $temporary_response; } } diff --git a/engine/Api/V1/Processors/Paginate.php b/engine/Api/V1/Processors/Paginate.php index 031f6a2b..a1b02775 100644 --- a/engine/Api/V1/Processors/Paginate.php +++ b/engine/Api/V1/Processors/Paginate.php @@ -30,7 +30,7 @@ class Paginate implements ProcessorsInterface { * Process Response Array * * Example: - * http://ea-installation.com/api/v1/appointments?page=3&length=30 + * http://example.org/api/v1/appointments?page=3&length=30 * * @param array &$response The response array to be processed. */ diff --git a/engine/Api/V1/Processors/Search.php b/engine/Api/V1/Processors/Search.php index fd89d0bb..2ec4cb89 100644 --- a/engine/Api/V1/Processors/Search.php +++ b/engine/Api/V1/Processors/Search.php @@ -35,18 +35,18 @@ class Search implements ProcessorsInterface { return; } - $searchedResponse = []; + $searched_response = []; $keyword = (string)$_GET['q']; foreach ($response as $entry) { - if (self::_recursiveArraySearch($entry, $keyword) !== FALSE) + if (self::recursive_array_search($entry, $keyword) !== FALSE) { - $searchedResponse[] = $entry; + $searched_response[] = $entry; } } - $response = $searchedResponse; + $response = $searched_response; } /** @@ -57,13 +57,13 @@ class Search implements ProcessorsInterface { * * @return int|bool Returns the index of the search occurrence or false it nothing was found. */ - protected static function _recursiveArraySearch(array $haystack, $needle) + protected static function recursive_array_search(array $haystack, $needle) { foreach ($haystack as $key => $value) { $currentKey = $key; - if (is_array($value) && self::_recursiveArraySearch($value, $needle) !== FALSE) + if (is_array($value) && self::recursive_array_search($value, $needle) !== FALSE) { return $currentKey; } diff --git a/engine/Api/V1/Processors/Sort.php b/engine/Api/V1/Processors/Sort.php index 234166b8..96605d60 100644 --- a/engine/Api/V1/Processors/Sort.php +++ b/engine/Api/V1/Processors/Sort.php @@ -40,56 +40,56 @@ class Sort implements ProcessorsInterface { $sort = explode(',', (string)$_GET['sort']); - $sortDirection1 = substr($sort[0], 0, 1) === '-' ? SORT_DESC : SORT_ASC; + $sort_direction1 = substr($sort[0], 0, 1) === '-' ? SORT_DESC : SORT_ASC; if (isset($sort[1])) { - $sortDirection2 = substr($sort[1], 0, 1) === '-' ? SORT_DESC : SORT_ASC; + $sort_direction2 = substr($sort[1], 0, 1) === '-' ? SORT_DESC : SORT_ASC; } else { - $sortDirection2 = NULL; + $sort_direction2 = NULL; } if (isset($sort[2])) { - $sortDirection3 = substr($sort[2], 0, 1) === '-' ? SORT_DESC : SORT_ASC; + $sort_direction3 = substr($sort[2], 0, 1) === '-' ? SORT_DESC : SORT_ASC; } else { - $sortDirection3 = NULL; + $sort_direction3 = NULL; } foreach ($response as $index => $entry) { - $sortOrder1[$index] = $entry[substr($sort[0], 1)]; + $sort_order1[$index] = $entry[substr($sort[0], 1)]; - if ($sortDirection2) + if ($sort_direction2) { - $sortOrder2[$index] = $entry[substr($sort[1], 1)]; + $sort_order2[$index] = $entry[substr($sort[1], 1)]; } - if ($sortDirection3) + if ($sort_direction3) { - $sortOrder3[$index] = $entry[substr($sort[2], 1)]; + $sort_order3[$index] = $entry[substr($sort[2], 1)]; } } $arguments = [ - &$sortOrder1, - &$sortDirection1 + &$sort_order1, + &$sort_direction1 ]; - if ($sortDirection2) + if ($sort_direction2) { - $arguments[] = $sortOrder2; - $arguments[] = $sortDirection2; + $arguments[] = $sort_order2; + $arguments[] = $sort_direction2; } - if ($sortDirection3) + if ($sort_direction3) { - $arguments[] = $sortOrder3; - $arguments[] = $sortDirection3; + $arguments[] = $sort_order3; + $arguments[] = $sort_direction3; } $arguments[] = &$response; diff --git a/engine/Api/V1/Request.php b/engine/Api/V1/Request.php index 9c3fd8f3..47c766f2 100644 --- a/engine/Api/V1/Request.php +++ b/engine/Api/V1/Request.php @@ -27,7 +27,7 @@ class Request { * * @return array */ - public function getBody() + public function get_body() { return json_decode(file_get_contents('php://input'), TRUE); } diff --git a/engine/Notifications/Email.php b/engine/Notifications/Email.php index bfbf6536..35dd2545 100755 --- a/engine/Notifications/Email.php +++ b/engine/Notifications/Email.php @@ -74,15 +74,15 @@ class Email { * "company_email" values are required in the array. * @param \EA\Engine\Types\Text $title The email title may vary depending the receiver. * @param \EA\Engine\Types\Text $message The email message may vary depending the receiver. - * @param \EA\Engine\Types\Url $appointmentLink This link is going to enable the receiver to make changes to the - * appointment record. - * @param \EA\Engine\Types\Email $recipientEmail The recipient email address. - * @param \EA\Engine\Types\Text $icsStream Stream contents of the ICS file. + * @param \EA\Engine\Types\Url $appointment_link_address This link is going to enable the receiver to make changes + * to the appointment record. + * @param \EA\Engine\Types\Email $recipient_email The recipient email address. + * @param \EA\Engine\Types\Text $ics_stream Stream contents of the ICS file. * @param string|null $timezone Custom timezone for the notification. * * @throws \PHPMailer\PHPMailer\Exception */ - public function sendAppointmentDetails( + public function send_appointment_details( array $appointment, array $provider, array $service, @@ -90,9 +90,9 @@ class Email { array $settings, Text $title, Text $message, - Url $appointmentLink, - EmailAddress $recipientEmail, - Text $icsStream, + Url $appointment_link_address, + EmailAddress $recipient_email, + Text $ics_stream, $timezone = NULL ) { @@ -146,7 +146,7 @@ class Email { $appointment_start_date = $appointment_start->format($date_format . ' ' . $time_format); $appointment_end_date = $appointment_end->format($date_format . ' ' . $time_format); $appointment_timezone = $timezones[empty($timezone) ? $provider['timezone'] : $timezone]; - $appointment_link = $appointmentLink->get(); + $appointment_link = $appointment_link_address->get(); $company_link = $settings['company_link']; $company_name = $settings['company_name']; $customer_name = $customer['first_name'] . ' ' . $customer['last_name']; @@ -161,10 +161,10 @@ class Email { $mailer = $this->create_mailer(); $mailer->From = $settings['company_email']; $mailer->FromName = $settings['company_name']; - $mailer->AddAddress($recipientEmail->get()); + $mailer->AddAddress($recipient_email->get()); $mailer->Subject = $title->get(); $mailer->Body = $html; - $mailer->addStringAttachment($icsStream->get(), 'invitation.ics'); + $mailer->addStringAttachment($ics_stream->get(), 'invitation.ics'); if ( ! $mailer->Send()) { @@ -188,19 +188,19 @@ class Email { * @param array $customer The record data of the appointment customer. * @param array $settings Some settings that are required for this function. As of now this array must contain * the following values: "company_link", "company_name", "company_email". - * @param \EA\Engine\Types\Email $recipientEmail The email address of the email recipient. + * @param \EA\Engine\Types\Email $recipient_email The email address of the email recipient. * @param \EA\Engine\Types\Text $reason The reason why the appointment is deleted. * @param string|null $timezone Custom timezone. * * @throws \PHPMailer\PHPMailer\Exception */ - public function sendDeleteAppointment( + public function send_delete_appointment( array $appointment, array $provider, array $service, array $customer, array $settings, - EmailAddress $recipientEmail, + EmailAddress $recipient_email, Text $reason, $timezone = NULL ) @@ -269,7 +269,7 @@ class Email { // Send email to recipient. $mailer->From = $settings['company_email']; $mailer->FromName = $settings['company_name']; - $mailer->AddAddress($recipientEmail->get()); // "Name" argument crushes the phpmailer class. + $mailer->AddAddress($recipient_email->get()); // "Name" argument crushes the phpmailer class. $mailer->Subject = $this->framework->lang->line('appointment_cancelled_title'); $mailer->Body = $html; @@ -286,8 +286,10 @@ class Email { * @param \EA\Engine\Types\NonEmptyText $password Contains the new password. * @param \EA\Engine\Types\Email $recipientEmail The receiver's email address. * @param array $company The company settings to be included in the email. + * + * @throws \PHPMailer\PHPMailer\Exception */ - public function sendPassword(NonEmptyText $password, EmailAddress $recipientEmail, array $company) + public function send_password(NonEmptyText $password, EmailAddress $recipientEmail, array $company) { $email_title = $this->framework->lang->line('new_account_password'); $password = '' . $password->get() . ''; diff --git a/engine/Types/Boolean.php b/engine/Types/Boolean.php index 2f0a1aa2..f8ecc672 100644 --- a/engine/Types/Boolean.php +++ b/engine/Types/Boolean.php @@ -25,7 +25,7 @@ class Boolean extends Type { * @param mixed $value * @return bool */ - protected function _validate($value) + protected function validate($value) { return is_bool($value); } diff --git a/engine/Types/Decimal.php b/engine/Types/Decimal.php index d30a37b3..1c7aa465 100644 --- a/engine/Types/Decimal.php +++ b/engine/Types/Decimal.php @@ -26,7 +26,7 @@ class Decimal extends Type { * @param mixed $value * @return bool */ - protected function _validate($value) + protected function validate($value) { return is_float($value); } diff --git a/engine/Types/Email.php b/engine/Types/Email.php index f3722c79..ed1b842d 100644 --- a/engine/Types/Email.php +++ b/engine/Types/Email.php @@ -21,8 +21,12 @@ namespace EA\Engine\Types; * @package EA\Engine\Types */ class Email extends NonEmptyText { - protected function _validate($value) + /** + * @param mixed $value + * @return bool + */ + protected function validate($value) { - return parent::_validate($value) && filter_var($value, FILTER_VALIDATE_EMAIL); + return parent::validate($value) && filter_var($value, FILTER_VALIDATE_EMAIL); } } diff --git a/engine/Types/Integer.php b/engine/Types/Integer.php index 60f32511..e1c1a4c7 100644 --- a/engine/Types/Integer.php +++ b/engine/Types/Integer.php @@ -25,7 +25,7 @@ class Integer extends Type { * @param mixed $value * @return bool */ - protected function _validate($value) + protected function validate($value) { return is_numeric($value) && ! is_float($value); } diff --git a/engine/Types/NonEmptyText.php b/engine/Types/NonEmptyText.php index ea0ef01b..bcbb117e 100644 --- a/engine/Types/NonEmptyText.php +++ b/engine/Types/NonEmptyText.php @@ -25,8 +25,8 @@ class NonEmptyText extends Text { * @param mixed $value * @return bool */ - protected function _validate($value) + protected function validate($value) { - return parent::_validate($value) && $value !== ''; + return parent::validate($value) && $value !== ''; } } diff --git a/engine/Types/Text.php b/engine/Types/Text.php index 518aa800..807e34a2 100644 --- a/engine/Types/Text.php +++ b/engine/Types/Text.php @@ -21,7 +21,11 @@ namespace EA\Engine\Types; * @package EA\Engine\Types */ class Text extends Type { - protected function _validate($value) + /** + * @param mixed $value + * @return bool + */ + protected function validate($value) { return is_string($value); } diff --git a/engine/Types/Type.php b/engine/Types/Type.php index d2298959..ca99d6e6 100644 --- a/engine/Types/Type.php +++ b/engine/Types/Type.php @@ -28,7 +28,7 @@ abstract class Type { */ public function __construct($value) { - if ( ! $this->_validate($value)) + if ( ! $this->validate($value)) { throw new \InvalidArgumentException(__CLASS__ . ': Invalid argument value provided (' . $value . ')'); } @@ -53,5 +53,5 @@ abstract class Type { * * @return bool Returns whether the value is valid or not. */ - abstract protected function _validate($value); + abstract protected function validate($value); } diff --git a/engine/Types/UnsignedInteger.php b/engine/Types/UnsignedInteger.php index de775916..e103bbfe 100644 --- a/engine/Types/UnsignedInteger.php +++ b/engine/Types/UnsignedInteger.php @@ -25,8 +25,8 @@ class UnsignedInteger extends Integer { * @param mixed $value * @return bool */ - protected function _validate($value) + protected function validate($value) { - return parent::_validate($value) && $value > -1; + return parent::validate($value) && $value > -1; } } diff --git a/engine/Types/Url.php b/engine/Types/Url.php index af7870be..27ed35ba 100644 --- a/engine/Types/Url.php +++ b/engine/Types/Url.php @@ -25,8 +25,8 @@ class Url extends NonEmptyText { * @param mixed $value * @return bool */ - protected function _validate($value) + protected function validate($value) { - return parent::_validate($value) && filter_var($value, FILTER_VALIDATE_URL); + return parent::validate($value) && filter_var($value, FILTER_VALIDATE_URL); } }