mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2025-01-01 03:22:26 +03:00
Add return types to all class methods
This commit is contained in:
parent
840286899a
commit
5d823985de
49 changed files with 186 additions and 181 deletions
|
@ -44,7 +44,7 @@ class About extends EA_Controller
|
|||
/**
|
||||
* Render the settings page.
|
||||
*/
|
||||
public function index()
|
||||
public function index(): void
|
||||
{
|
||||
session(['dest_url' => site_url('about')]);
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ class Account extends EA_Controller
|
|||
/**
|
||||
* Render the settings page.
|
||||
*/
|
||||
public function index()
|
||||
public function index(): void
|
||||
{
|
||||
session(['dest_url' => site_url('account')]);
|
||||
|
||||
|
@ -79,7 +79,7 @@ class Account extends EA_Controller
|
|||
/**
|
||||
* Save general settings.
|
||||
*/
|
||||
public function save()
|
||||
public function save(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('edit', PRIV_USER_SETTINGS)) {
|
||||
|
@ -131,7 +131,7 @@ class Account extends EA_Controller
|
|||
/**
|
||||
* Make sure the username is valid and unique in the database.
|
||||
*/
|
||||
public function validate_username()
|
||||
public function validate_username(): void
|
||||
{
|
||||
try {
|
||||
$username = request('username');
|
||||
|
|
|
@ -41,7 +41,7 @@ class Admins extends EA_Controller
|
|||
* On this page admin users will be able to manage admins, which are eventually selected by customers during the
|
||||
* booking process.
|
||||
*/
|
||||
public function index()
|
||||
public function index(): void
|
||||
{
|
||||
session(['dest_url' => site_url('admins')]);
|
||||
|
||||
|
@ -82,7 +82,7 @@ class Admins extends EA_Controller
|
|||
/**
|
||||
* Filter admins by the provided keyword.
|
||||
*/
|
||||
public function search()
|
||||
public function search(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('view', PRIV_USERS)) {
|
||||
|
@ -108,7 +108,7 @@ class Admins extends EA_Controller
|
|||
/**
|
||||
* Store a new admin.
|
||||
*/
|
||||
public function store()
|
||||
public function store(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('add', PRIV_USERS)) {
|
||||
|
@ -153,7 +153,7 @@ class Admins extends EA_Controller
|
|||
/**
|
||||
* Find an admin.
|
||||
*/
|
||||
public function find()
|
||||
public function find(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('view', PRIV_USERS)) {
|
||||
|
@ -173,7 +173,7 @@ class Admins extends EA_Controller
|
|||
/**
|
||||
* Update an admin.
|
||||
*/
|
||||
public function update()
|
||||
public function update(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('edit', PRIV_USERS)) {
|
||||
|
@ -219,7 +219,7 @@ class Admins extends EA_Controller
|
|||
/**
|
||||
* Remove an admin.
|
||||
*/
|
||||
public function destroy()
|
||||
public function destroy(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('delete', PRIV_USERS)) {
|
||||
|
|
|
@ -35,7 +35,7 @@ class Api_settings extends EA_Controller
|
|||
/**
|
||||
* Render the settings page.
|
||||
*/
|
||||
public function index()
|
||||
public function index(): void
|
||||
{
|
||||
session(['dest_url' => site_url('api_settings')]);
|
||||
|
||||
|
@ -71,7 +71,7 @@ class Api_settings extends EA_Controller
|
|||
/**
|
||||
* Save general settings.
|
||||
*/
|
||||
public function save()
|
||||
public function save(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('edit', PRIV_SYSTEM_SETTINGS)) {
|
||||
|
|
|
@ -53,7 +53,7 @@ class Appointments extends EA_Controller
|
|||
/**
|
||||
* Filter appointments by the provided keyword.
|
||||
*/
|
||||
public function search()
|
||||
public function search(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('view', PRIV_APPOINTMENTS)) {
|
||||
|
@ -79,7 +79,7 @@ class Appointments extends EA_Controller
|
|||
/**
|
||||
* Store a new appointment.
|
||||
*/
|
||||
public function store()
|
||||
public function store(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('add', PRIV_APPOINTMENTS)) {
|
||||
|
@ -118,7 +118,7 @@ class Appointments extends EA_Controller
|
|||
/**
|
||||
* Find an appointment.
|
||||
*/
|
||||
public function find()
|
||||
public function find(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('view', PRIV_APPOINTMENTS)) {
|
||||
|
@ -138,7 +138,7 @@ class Appointments extends EA_Controller
|
|||
/**
|
||||
* Update a appointment.
|
||||
*/
|
||||
public function update()
|
||||
public function update(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('edit', PRIV_APPOINTMENTS)) {
|
||||
|
@ -174,7 +174,7 @@ class Appointments extends EA_Controller
|
|||
/**
|
||||
* Remove a appointment.
|
||||
*/
|
||||
public function destroy()
|
||||
public function destroy(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('delete', PRIV_APPOINTMENTS)) {
|
||||
|
|
|
@ -46,7 +46,7 @@ class Backend extends EA_Controller
|
|||
*
|
||||
* @param string $appointment_hash Appointment edit dialog will appear when the page loads (default '').
|
||||
*/
|
||||
public function index(string $appointment_hash = '')
|
||||
public function index(string $appointment_hash = ''): void
|
||||
{
|
||||
if (empty($appointment_hash)) {
|
||||
redirect('calendar');
|
||||
|
@ -58,7 +58,7 @@ class Backend extends EA_Controller
|
|||
/**
|
||||
* Display the customers page.
|
||||
*/
|
||||
public function customers()
|
||||
public function customers(): void
|
||||
{
|
||||
redirect('customers');
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ class Backend extends EA_Controller
|
|||
/**
|
||||
* Display the services page.
|
||||
*/
|
||||
public function services()
|
||||
public function services(): void
|
||||
{
|
||||
redirect('services');
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ class Backend extends EA_Controller
|
|||
* Notice: Since the "users" page is split into multiple pages (providers, secretaries, admins), this method will
|
||||
* redirect to "providers" page by default
|
||||
*/
|
||||
public function users()
|
||||
public function users(): void
|
||||
{
|
||||
redirect('providers');
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ class Backend extends EA_Controller
|
|||
* Notice: Since the "settings" page is split into multiple pages (general, business, booking etc), this method will
|
||||
* redirect to "general" page by default.
|
||||
*/
|
||||
public function settings()
|
||||
public function settings(): void
|
||||
{
|
||||
redirect('general_settings');
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ class Backend extends EA_Controller
|
|||
/**
|
||||
* Display the update page.
|
||||
*/
|
||||
public function update()
|
||||
public function update(): void
|
||||
{
|
||||
redirect('update');
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ class Backend_api extends EA_Controller
|
|||
/**
|
||||
* Get Calendar Events
|
||||
*/
|
||||
public function ajax_get_calendar_events()
|
||||
public function ajax_get_calendar_events(): void
|
||||
{
|
||||
redirect('calendar/get_calendar_appointments_for_table_view');
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ class Backend_api extends EA_Controller
|
|||
/**
|
||||
* Get the registered appointments for the given date period and record.
|
||||
*/
|
||||
public function ajax_get_calendar_appointments()
|
||||
public function ajax_get_calendar_appointments(): void
|
||||
{
|
||||
redirect('calendar/get_calendar_appointments');
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ class Backend_api extends EA_Controller
|
|||
/**
|
||||
* Save appointment changes that are made from the backend calendar page.
|
||||
*/
|
||||
public function ajax_save_appointment()
|
||||
public function ajax_save_appointment(): void
|
||||
{
|
||||
redirect('calendar/save_appointment');
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ class Backend_api extends EA_Controller
|
|||
/**
|
||||
* Delete appointment from the database.
|
||||
*/
|
||||
public function ajax_delete_appointment()
|
||||
public function ajax_delete_appointment(): void
|
||||
{
|
||||
redirect('calendar/delete_appointment');
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ class Backend_api extends EA_Controller
|
|||
/**
|
||||
* Disable a providers sync setting.
|
||||
*/
|
||||
public function ajax_disable_provider_sync()
|
||||
public function ajax_disable_provider_sync(): void
|
||||
{
|
||||
redirect('google/disable_provider_sync');
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ class Backend_api extends EA_Controller
|
|||
/**
|
||||
* Filter the customer records with the given key string.
|
||||
*/
|
||||
public function ajax_filter_customers()
|
||||
public function ajax_filter_customers(): void
|
||||
{
|
||||
redirect('customers/search');
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ class Backend_api extends EA_Controller
|
|||
/**
|
||||
* Insert or update an unavailability.
|
||||
*/
|
||||
public function ajax_save_unavailability()
|
||||
public function ajax_save_unavailability(): void
|
||||
{
|
||||
redirect('calendar/save_unavailability');
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ class Backend_api extends EA_Controller
|
|||
/**
|
||||
* Delete an unavailability time period from database.
|
||||
*/
|
||||
public function ajax_delete_unavailability()
|
||||
public function ajax_delete_unavailability(): void
|
||||
{
|
||||
redirect('calendar/delete_unavailability');
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ class Backend_api extends EA_Controller
|
|||
/**
|
||||
* Insert of update working plan exceptions to database.
|
||||
*/
|
||||
public function ajax_save_working_plan_exception()
|
||||
public function ajax_save_working_plan_exception(): void
|
||||
{
|
||||
redirect('calendar/save_working_plan_exception');
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ class Backend_api extends EA_Controller
|
|||
/**
|
||||
* Delete a working plan exceptions time period to database.
|
||||
*/
|
||||
public function ajax_delete_working_plan_exception()
|
||||
public function ajax_delete_working_plan_exception(): void
|
||||
{
|
||||
redirect('calendar/delete_working_plan_exception');
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ class Backend_api extends EA_Controller
|
|||
/**
|
||||
* Save (insert or update) a customer record.
|
||||
*/
|
||||
public function ajax_save_customer()
|
||||
public function ajax_save_customer(): void
|
||||
{
|
||||
redirect('customers/create'); // or "customers/update"
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ class Backend_api extends EA_Controller
|
|||
/**
|
||||
* Delete customer from database.
|
||||
*/
|
||||
public function ajax_delete_customer()
|
||||
public function ajax_delete_customer(): void
|
||||
{
|
||||
redirect('customers/destroy');
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ class Backend_api extends EA_Controller
|
|||
/**
|
||||
* Save (insert or update) service record.
|
||||
*/
|
||||
public function ajax_save_service()
|
||||
public function ajax_save_service(): void
|
||||
{
|
||||
redirect('services/create'); // or "services/update"
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ class Backend_api extends EA_Controller
|
|||
/**
|
||||
* Delete service record from database.
|
||||
*/
|
||||
public function ajax_delete_service()
|
||||
public function ajax_delete_service(): void
|
||||
{
|
||||
redirect('services/destroy');
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ class Backend_api extends EA_Controller
|
|||
/**
|
||||
* Filter service records by given key string.
|
||||
*/
|
||||
public function ajax_filter_services()
|
||||
public function ajax_filter_services(): void
|
||||
{
|
||||
redirect('services/search');
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ class Backend_api extends EA_Controller
|
|||
/**
|
||||
* Save (insert or update) category record.
|
||||
*/
|
||||
public function ajax_save_service_category()
|
||||
public function ajax_save_service_category(): void
|
||||
{
|
||||
redirect('categories/create'); // or "categories/update"
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ class Backend_api extends EA_Controller
|
|||
/**
|
||||
* Delete category record from database.
|
||||
*/
|
||||
public function ajax_delete_service_category()
|
||||
public function ajax_delete_service_category(): void
|
||||
{
|
||||
redirect('categories/destroy');
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ class Backend_api extends EA_Controller
|
|||
/**
|
||||
* Filter services categories with key string.
|
||||
*/
|
||||
public function ajax_filter_service_categories()
|
||||
public function ajax_filter_service_categories(): void
|
||||
{
|
||||
redirect('categories/search');
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ class Backend_api extends EA_Controller
|
|||
/**
|
||||
* Filter admin records with string key.
|
||||
*/
|
||||
public function ajax_filter_admins()
|
||||
public function ajax_filter_admins(): void
|
||||
{
|
||||
redirect('admins/search');
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ class Backend_api extends EA_Controller
|
|||
/**
|
||||
* Save (insert or update) admin record into database.
|
||||
*/
|
||||
public function ajax_save_admin()
|
||||
public function ajax_save_admin(): void
|
||||
{
|
||||
redirect('admins/create'); // or "admins/update"
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ class Backend_api extends EA_Controller
|
|||
/**
|
||||
* Delete an admin record from the database.
|
||||
*/
|
||||
public function ajax_delete_admin()
|
||||
public function ajax_delete_admin(): void
|
||||
{
|
||||
redirect('admins/destroy');
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ class Backend_api extends EA_Controller
|
|||
/**
|
||||
* Filter provider records with string key.
|
||||
*/
|
||||
public function ajax_filter_providers()
|
||||
public function ajax_filter_providers(): void
|
||||
{
|
||||
redirect('providers/search');
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ class Backend_api extends EA_Controller
|
|||
/**
|
||||
* Save (insert or update) a provider record into database.
|
||||
*/
|
||||
public function ajax_save_provider()
|
||||
public function ajax_save_provider(): void
|
||||
{
|
||||
redirect('providers/create'); // or "providers/update"
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ class Backend_api extends EA_Controller
|
|||
/**
|
||||
* Delete a provider record from the database.
|
||||
*/
|
||||
public function ajax_delete_provider()
|
||||
public function ajax_delete_provider(): void
|
||||
{
|
||||
redirect('providers/destroy');
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ class Backend_api extends EA_Controller
|
|||
/**
|
||||
* Filter secretary records with string key.
|
||||
*/
|
||||
public function ajax_filter_secretaries()
|
||||
public function ajax_filter_secretaries(): void
|
||||
{
|
||||
redirect('secretaries/search');
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ class Backend_api extends EA_Controller
|
|||
/**
|
||||
* Save (insert or update) a secretary record into database.
|
||||
*/
|
||||
public function ajax_save_secretary()
|
||||
public function ajax_save_secretary(): void
|
||||
{
|
||||
redirect('secretaries/create'); // or "secretaries/update"
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ class Backend_api extends EA_Controller
|
|||
/**
|
||||
* Delete a secretary record from the database.
|
||||
*/
|
||||
public function ajax_delete_secretary()
|
||||
public function ajax_delete_secretary(): void
|
||||
{
|
||||
redirect('secretaries/destroy');
|
||||
}
|
||||
|
@ -260,7 +260,7 @@ class Backend_api extends EA_Controller
|
|||
/**
|
||||
* Save a setting or multiple settings in the database.
|
||||
*/
|
||||
public function ajax_save_settings()
|
||||
public function ajax_save_settings(): void
|
||||
{
|
||||
redirect('general_settings/save'); // or "business_settings/save", "booking_settings/save", "legal_settings/save"
|
||||
}
|
||||
|
@ -268,7 +268,7 @@ class Backend_api extends EA_Controller
|
|||
/**
|
||||
* This method checks whether the username already exists in the database.
|
||||
*/
|
||||
public function ajax_validate_username()
|
||||
public function ajax_validate_username(): void
|
||||
{
|
||||
redirect('account/validate_username');
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ class Backend_api extends EA_Controller
|
|||
/**
|
||||
* Change system language for current user.
|
||||
*/
|
||||
public function ajax_change_language()
|
||||
public function ajax_change_language(): void
|
||||
{
|
||||
redirect('account/change_language');
|
||||
}
|
||||
|
@ -284,7 +284,7 @@ class Backend_api extends EA_Controller
|
|||
/**
|
||||
* This method will return a list of the available Google Calendars.
|
||||
*/
|
||||
public function ajax_get_google_calendars()
|
||||
public function ajax_get_google_calendars(): void
|
||||
{
|
||||
redirect('google/get_google_calendars');
|
||||
}
|
||||
|
@ -292,7 +292,7 @@ class Backend_api extends EA_Controller
|
|||
/**
|
||||
* Select a specific google calendar for a provider.
|
||||
*/
|
||||
public function ajax_select_google_calendar()
|
||||
public function ajax_select_google_calendar(): void
|
||||
{
|
||||
redirect('google/select_google_calendar');
|
||||
}
|
||||
|
@ -300,7 +300,7 @@ class Backend_api extends EA_Controller
|
|||
/**
|
||||
* Apply global working plan to all providers.
|
||||
*/
|
||||
public function ajax_apply_global_working_plan()
|
||||
public function ajax_apply_global_working_plan(): void
|
||||
{
|
||||
redirect('business_settings/apply_global_working_plan');
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ class Blocked_periods extends EA_Controller
|
|||
* On this page admin users will be able to manage blocked-periods, which are eventually selected by customers during the
|
||||
* booking process.
|
||||
*/
|
||||
public function index()
|
||||
public function index(): void
|
||||
{
|
||||
session(['dest_url' => site_url('blocked_periods')]);
|
||||
|
||||
|
@ -81,7 +81,7 @@ class Blocked_periods extends EA_Controller
|
|||
/**
|
||||
* Filter blocked-periods by the provided keyword.
|
||||
*/
|
||||
public function search()
|
||||
public function search(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('view', PRIV_BLOCKED_PERIODS)) {
|
||||
|
@ -107,7 +107,7 @@ class Blocked_periods extends EA_Controller
|
|||
/**
|
||||
* Store a new service-category.
|
||||
*/
|
||||
public function store()
|
||||
public function store(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('add', PRIV_BLOCKED_PERIODS)) {
|
||||
|
@ -136,7 +136,7 @@ class Blocked_periods extends EA_Controller
|
|||
/**
|
||||
* Find a service-category.
|
||||
*/
|
||||
public function find()
|
||||
public function find(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('view', PRIV_BLOCKED_PERIODS)) {
|
||||
|
@ -156,7 +156,7 @@ class Blocked_periods extends EA_Controller
|
|||
/**
|
||||
* Update a service-category.
|
||||
*/
|
||||
public function update()
|
||||
public function update(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('edit', PRIV_BLOCKED_PERIODS)) {
|
||||
|
@ -191,7 +191,7 @@ class Blocked_periods extends EA_Controller
|
|||
/**
|
||||
* Remove a service-category.
|
||||
*/
|
||||
public function destroy()
|
||||
public function destroy(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('delete', PRIV_BLOCKED_PERIODS)) {
|
||||
|
|
|
@ -54,7 +54,7 @@ class Booking extends EA_Controller
|
|||
*
|
||||
* @param string $appointment_hash
|
||||
*/
|
||||
public function reschedule(string $appointment_hash)
|
||||
public function reschedule(string $appointment_hash): void
|
||||
{
|
||||
html_vars(['appointment_hash' => $appointment_hash]);
|
||||
|
||||
|
@ -66,7 +66,7 @@ class Booking extends EA_Controller
|
|||
*
|
||||
* This method creates the appointment book wizard.
|
||||
*/
|
||||
public function index()
|
||||
public function index(): void
|
||||
{
|
||||
if (!is_app_installed()) {
|
||||
redirect('installation');
|
||||
|
@ -289,7 +289,7 @@ class Booking extends EA_Controller
|
|||
/**
|
||||
* Register the appointment to the database.
|
||||
*/
|
||||
public function register()
|
||||
public function register(): void
|
||||
{
|
||||
try {
|
||||
$disable_booking = setting('disable_booking');
|
||||
|
@ -584,7 +584,7 @@ class Booking extends EA_Controller
|
|||
* This method answers to an AJAX request. It calculates the available hours for the given service, provider and
|
||||
* date.
|
||||
*/
|
||||
public function get_available_hours()
|
||||
public function get_available_hours(): void
|
||||
{
|
||||
try {
|
||||
$disable_booking = setting('disable_booking');
|
||||
|
@ -666,7 +666,7 @@ class Booking extends EA_Controller
|
|||
*
|
||||
* Outputs a JSON string with the unavailability dates. that are unavailability.
|
||||
*/
|
||||
public function get_unavailable_dates()
|
||||
public function get_unavailable_dates(): void
|
||||
{
|
||||
try {
|
||||
$disable_booking = setting('disable_booking');
|
||||
|
|
|
@ -46,7 +46,7 @@ class Booking_cancellation extends EA_Controller
|
|||
*
|
||||
* @param string $appointment_hash This appointment hash identifier.
|
||||
*/
|
||||
public function of(string $appointment_hash)
|
||||
public function of(string $appointment_hash): void
|
||||
{
|
||||
try {
|
||||
$disable_booking = setting('disable_booking');
|
||||
|
|
|
@ -40,7 +40,7 @@ class Booking_confirmation extends EA_Controller
|
|||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function of()
|
||||
public function of(): void
|
||||
{
|
||||
$appointment_hash = $this->uri->segment(3);
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ class Booking_settings extends EA_Controller
|
|||
/**
|
||||
* Render the settings page.
|
||||
*/
|
||||
public function index()
|
||||
public function index(): void
|
||||
{
|
||||
session(['dest_url' => site_url('booking_settings')]);
|
||||
|
||||
|
@ -80,7 +80,7 @@ class Booking_settings extends EA_Controller
|
|||
/**
|
||||
* Save booking settings.
|
||||
*/
|
||||
public function save()
|
||||
public function save(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('edit', PRIV_SYSTEM_SETTINGS)) {
|
||||
|
|
|
@ -44,7 +44,7 @@ class Business_settings extends EA_Controller
|
|||
/**
|
||||
* Render the settings page.
|
||||
*/
|
||||
public function index()
|
||||
public function index(): void
|
||||
{
|
||||
session(['dest_url' => site_url('business_settings')]);
|
||||
|
||||
|
@ -82,7 +82,7 @@ class Business_settings extends EA_Controller
|
|||
/**
|
||||
* Save general settings.
|
||||
*/
|
||||
public function save()
|
||||
public function save(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('edit', PRIV_SYSTEM_SETTINGS)) {
|
||||
|
|
|
@ -33,7 +33,7 @@ class Captcha extends EA_Controller
|
|||
/**
|
||||
* Make a request to this method to get a captcha image.
|
||||
*/
|
||||
public function index()
|
||||
public function index(): void
|
||||
{
|
||||
$this->captcha_builder->setDistortion(true);
|
||||
$this->captcha_builder->setMaxBehindLines(1);
|
||||
|
|
|
@ -33,7 +33,7 @@ class Consents extends EA_Controller
|
|||
/**
|
||||
* Save (insert or update) the consent
|
||||
*/
|
||||
public function save()
|
||||
public function save(): void
|
||||
{
|
||||
try {
|
||||
$consent = request('consent');
|
||||
|
|
|
@ -50,8 +50,10 @@ class Console extends EA_Controller
|
|||
* Usage:
|
||||
*
|
||||
* php index.php console install
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function install()
|
||||
public function install(): void
|
||||
{
|
||||
$this->instance->migrate('fresh');
|
||||
|
||||
|
@ -70,7 +72,7 @@ class Console extends EA_Controller
|
|||
* Notice:
|
||||
*
|
||||
* Do not use this method to install the app as it will not seed the database with the initial entries (admin,
|
||||
* provider, service, settings etc).
|
||||
* provider, service, settings etc.).
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
|
@ -80,7 +82,7 @@ class Console extends EA_Controller
|
|||
*
|
||||
* @param string $type
|
||||
*/
|
||||
public function migrate(string $type = '')
|
||||
public function migrate(string $type = ''): void
|
||||
{
|
||||
$this->instance->migrate($type);
|
||||
}
|
||||
|
@ -93,8 +95,9 @@ class Console extends EA_Controller
|
|||
* Usage:
|
||||
*
|
||||
* php index.php console seed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function seed()
|
||||
public function seed(): void
|
||||
{
|
||||
$this->instance->seed();
|
||||
}
|
||||
|
@ -112,7 +115,7 @@ class Console extends EA_Controller
|
|||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function backup()
|
||||
public function backup(): void
|
||||
{
|
||||
$this->instance->backup($GLOBALS['argv'][3] ?? null);
|
||||
}
|
||||
|
@ -130,7 +133,7 @@ class Console extends EA_Controller
|
|||
*
|
||||
* php index.php console sync
|
||||
*/
|
||||
public function sync()
|
||||
public function sync(): void
|
||||
{
|
||||
$providers = $this->providers_model->get();
|
||||
|
||||
|
@ -152,7 +155,7 @@ class Console extends EA_Controller
|
|||
*
|
||||
* php index.php console help
|
||||
*/
|
||||
public function help()
|
||||
public function help(): void
|
||||
{
|
||||
$help = [
|
||||
'',
|
||||
|
|
|
@ -44,7 +44,7 @@ class Customers extends EA_Controller
|
|||
* On this page admin users will be able to manage customers, which are eventually selected by customers during the
|
||||
* booking process.
|
||||
*/
|
||||
public function index()
|
||||
public function index(): void
|
||||
{
|
||||
session(['dest_url' => site_url('customers')]);
|
||||
|
||||
|
@ -114,7 +114,7 @@ class Customers extends EA_Controller
|
|||
/**
|
||||
* Find a customer.
|
||||
*/
|
||||
public function find()
|
||||
public function find(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('view', PRIV_CUSTOMERS)) {
|
||||
|
@ -140,7 +140,7 @@ class Customers extends EA_Controller
|
|||
/**
|
||||
* Filter customers by the provided keyword.
|
||||
*/
|
||||
public function search()
|
||||
public function search(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('view', PRIV_CUSTOMERS)) {
|
||||
|
@ -184,7 +184,7 @@ class Customers extends EA_Controller
|
|||
/**
|
||||
* Store a new customer.
|
||||
*/
|
||||
public function store()
|
||||
public function store(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('add', PRIV_CUSTOMERS)) {
|
||||
|
@ -234,7 +234,7 @@ class Customers extends EA_Controller
|
|||
/**
|
||||
* Update a customer.
|
||||
*/
|
||||
public function update()
|
||||
public function update(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('edit', PRIV_CUSTOMERS)) {
|
||||
|
@ -287,7 +287,7 @@ class Customers extends EA_Controller
|
|||
/**
|
||||
* Remove a customer.
|
||||
*/
|
||||
public function destroy()
|
||||
public function destroy(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('delete', PRIV_CUSTOMERS)) {
|
||||
|
|
|
@ -36,7 +36,7 @@ class General_settings extends EA_Controller
|
|||
/**
|
||||
* Render the settings page.
|
||||
*/
|
||||
public function index()
|
||||
public function index(): void
|
||||
{
|
||||
session(['dest_url' => site_url('general_settings')]);
|
||||
|
||||
|
@ -81,7 +81,7 @@ class General_settings extends EA_Controller
|
|||
/**
|
||||
* Save general settings.
|
||||
*/
|
||||
public function save()
|
||||
public function save(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('edit', PRIV_SYSTEM_SETTINGS)) {
|
||||
|
|
|
@ -35,7 +35,7 @@ class Google_analytics_settings extends EA_Controller
|
|||
/**
|
||||
* Render the settings page.
|
||||
*/
|
||||
public function index()
|
||||
public function index(): void
|
||||
{
|
||||
session(['dest_url' => site_url('google_analytics_settings')]);
|
||||
|
||||
|
@ -71,7 +71,7 @@ class Google_analytics_settings extends EA_Controller
|
|||
/**
|
||||
* Save general settings.
|
||||
*/
|
||||
public function save()
|
||||
public function save(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('edit', PRIV_SYSTEM_SETTINGS)) {
|
||||
|
|
|
@ -39,7 +39,7 @@ class Installation extends EA_Controller
|
|||
/**
|
||||
* Display the installation page.
|
||||
*/
|
||||
public function index()
|
||||
public function index(): void
|
||||
{
|
||||
if (is_app_installed()) {
|
||||
redirect();
|
||||
|
|
|
@ -44,7 +44,7 @@ class Integrations extends EA_Controller
|
|||
/**
|
||||
* Render the settings page.
|
||||
*/
|
||||
public function index()
|
||||
public function index(): void
|
||||
{
|
||||
session(['dest_url' => site_url('about')]);
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class Legal_settings extends EA_Controller
|
|||
/**
|
||||
* Render the settings page.
|
||||
*/
|
||||
public function index()
|
||||
public function index(): void
|
||||
{
|
||||
session(['dest_url' => site_url('legal_settings')]);
|
||||
|
||||
|
@ -71,7 +71,7 @@ class Legal_settings extends EA_Controller
|
|||
/**
|
||||
* Save legal settings.
|
||||
*/
|
||||
public function save()
|
||||
public function save(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('edit', PRIV_SYSTEM_SETTINGS)) {
|
||||
|
|
|
@ -27,7 +27,7 @@ class Localization extends EA_Controller
|
|||
*
|
||||
* Notice: This method used to be in the Backend_api.php.
|
||||
*/
|
||||
public function change_language()
|
||||
public function change_language(): void
|
||||
{
|
||||
try {
|
||||
// Check if language exists in the available languages.
|
||||
|
|
|
@ -38,7 +38,7 @@ class Login extends EA_Controller
|
|||
/**
|
||||
* Render the login page.
|
||||
*/
|
||||
public function index()
|
||||
public function index(): void
|
||||
{
|
||||
if (session('user_id')) {
|
||||
redirect('calendar');
|
||||
|
@ -58,7 +58,7 @@ class Login extends EA_Controller
|
|||
/**
|
||||
* Validate the provided credentials and start a new session if the validation was successful.
|
||||
*/
|
||||
public function validate()
|
||||
public function validate(): void
|
||||
{
|
||||
try {
|
||||
$username = request('username');
|
||||
|
|
|
@ -23,7 +23,7 @@ class Logout extends EA_Controller
|
|||
/**
|
||||
* Render the logout page.
|
||||
*/
|
||||
public function index()
|
||||
public function index(): void
|
||||
{
|
||||
$this->session->sess_destroy();
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class Matomo_analytics_settings extends EA_Controller
|
|||
/**
|
||||
* Render the settings page.
|
||||
*/
|
||||
public function index()
|
||||
public function index(): void
|
||||
{
|
||||
session(['dest_url' => site_url('matomo_analytics_settings')]);
|
||||
|
||||
|
@ -71,7 +71,7 @@ class Matomo_analytics_settings extends EA_Controller
|
|||
/**
|
||||
* Save general settings.
|
||||
*/
|
||||
public function save()
|
||||
public function save(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('edit', PRIV_SYSTEM_SETTINGS)) {
|
||||
|
|
|
@ -35,7 +35,7 @@ class Privacy extends EA_Controller
|
|||
/**
|
||||
* Remove all customer data (including appointments) from the system.
|
||||
*/
|
||||
public function delete_personal_information()
|
||||
public function delete_personal_information(): void
|
||||
{
|
||||
try {
|
||||
$display_delete_personal_information = setting('display_delete_personal_information');
|
||||
|
|
|
@ -42,7 +42,7 @@ class Providers extends EA_Controller
|
|||
* On this page admin users will be able to manage providers, which are eventually selected by customers during the
|
||||
* booking process.
|
||||
*/
|
||||
public function index()
|
||||
public function index(): void
|
||||
{
|
||||
session(['dest_url' => site_url('providers')]);
|
||||
|
||||
|
@ -95,7 +95,7 @@ class Providers extends EA_Controller
|
|||
/**
|
||||
* Filter providers by the provided keyword.
|
||||
*/
|
||||
public function search()
|
||||
public function search(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('view', PRIV_USERS)) {
|
||||
|
@ -121,7 +121,7 @@ class Providers extends EA_Controller
|
|||
/**
|
||||
* Store a new provider.
|
||||
*/
|
||||
public function store()
|
||||
public function store(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('add', PRIV_USERS)) {
|
||||
|
@ -180,7 +180,7 @@ class Providers extends EA_Controller
|
|||
/**
|
||||
* Find a provider.
|
||||
*/
|
||||
public function find()
|
||||
public function find(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('view', PRIV_USERS)) {
|
||||
|
@ -200,7 +200,7 @@ class Providers extends EA_Controller
|
|||
/**
|
||||
* Update a provider.
|
||||
*/
|
||||
public function update()
|
||||
public function update(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('edit', PRIV_USERS)) {
|
||||
|
@ -260,7 +260,7 @@ class Providers extends EA_Controller
|
|||
/**
|
||||
* Remove a provider.
|
||||
*/
|
||||
public function destroy()
|
||||
public function destroy(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('delete', PRIV_USERS)) {
|
||||
|
|
|
@ -34,7 +34,7 @@ class Recovery extends EA_Controller
|
|||
/**
|
||||
* Display the password recovery page.
|
||||
*/
|
||||
public function index()
|
||||
public function index(): void
|
||||
{
|
||||
$company_name = setting('company_name');
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class Secretaries extends EA_Controller
|
|||
* On this page secretary users will be able to manage secretaries, which are eventually selected by customers during the
|
||||
* booking process.
|
||||
*/
|
||||
public function index()
|
||||
public function index(): void
|
||||
{
|
||||
session(['dest_url' => site_url('secretaries')]);
|
||||
|
||||
|
@ -91,7 +91,7 @@ class Secretaries extends EA_Controller
|
|||
/**
|
||||
* Filter secretaries by the provided keyword.
|
||||
*/
|
||||
public function search()
|
||||
public function search(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('view', PRIV_USERS)) {
|
||||
|
@ -117,7 +117,7 @@ class Secretaries extends EA_Controller
|
|||
/**
|
||||
* Store a new secretary.
|
||||
*/
|
||||
public function store()
|
||||
public function store(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('add', PRIV_USERS)) {
|
||||
|
@ -174,7 +174,7 @@ class Secretaries extends EA_Controller
|
|||
/**
|
||||
* Find a secretary.
|
||||
*/
|
||||
public function find()
|
||||
public function find(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('view', PRIV_USERS)) {
|
||||
|
@ -194,7 +194,7 @@ class Secretaries extends EA_Controller
|
|||
/**
|
||||
* Update a secretary.
|
||||
*/
|
||||
public function update()
|
||||
public function update(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('edit', PRIV_USERS)) {
|
||||
|
@ -252,7 +252,7 @@ class Secretaries extends EA_Controller
|
|||
/**
|
||||
* Remove a secretary.
|
||||
*/
|
||||
public function destroy()
|
||||
public function destroy(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('delete', PRIV_USERS)) {
|
||||
|
|
|
@ -41,7 +41,7 @@ class Service_categories extends EA_Controller
|
|||
* On this page admin users will be able to manage service-categories, which are eventually selected by customers during the
|
||||
* booking process.
|
||||
*/
|
||||
public function index()
|
||||
public function index(): void
|
||||
{
|
||||
session(['dest_url' => site_url('service_categories')]);
|
||||
|
||||
|
@ -78,7 +78,7 @@ class Service_categories extends EA_Controller
|
|||
/**
|
||||
* Filter service-categories by the provided keyword.
|
||||
*/
|
||||
public function search()
|
||||
public function search(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('view', PRIV_SERVICES)) {
|
||||
|
@ -104,7 +104,7 @@ class Service_categories extends EA_Controller
|
|||
/**
|
||||
* Store a new service-category.
|
||||
*/
|
||||
public function store()
|
||||
public function store(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('add', PRIV_SERVICES)) {
|
||||
|
@ -133,7 +133,7 @@ class Service_categories extends EA_Controller
|
|||
/**
|
||||
* Find a service-category.
|
||||
*/
|
||||
public function find()
|
||||
public function find(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('view', PRIV_SERVICES)) {
|
||||
|
@ -153,7 +153,7 @@ class Service_categories extends EA_Controller
|
|||
/**
|
||||
* Update a service-category.
|
||||
*/
|
||||
public function update()
|
||||
public function update(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('edit', PRIV_SERVICES)) {
|
||||
|
@ -182,7 +182,7 @@ class Service_categories extends EA_Controller
|
|||
/**
|
||||
* Remove a service-category.
|
||||
*/
|
||||
public function destroy()
|
||||
public function destroy(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('delete', PRIV_SERVICES)) {
|
||||
|
|
|
@ -41,7 +41,7 @@ class Services extends EA_Controller
|
|||
* On this page admin users will be able to manage services, which are eventually selected by customers during the
|
||||
* booking process.
|
||||
*/
|
||||
public function index()
|
||||
public function index(): void
|
||||
{
|
||||
session(['dest_url' => site_url('services')]);
|
||||
|
||||
|
@ -79,7 +79,7 @@ class Services extends EA_Controller
|
|||
/**
|
||||
* Filter services by the provided keyword.
|
||||
*/
|
||||
public function search()
|
||||
public function search(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('view', PRIV_SERVICES)) {
|
||||
|
@ -105,7 +105,7 @@ class Services extends EA_Controller
|
|||
/**
|
||||
* Store a new service.
|
||||
*/
|
||||
public function store()
|
||||
public function store(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('add', PRIV_SERVICES)) {
|
||||
|
@ -150,7 +150,7 @@ class Services extends EA_Controller
|
|||
/**
|
||||
* Find a service.
|
||||
*/
|
||||
public function find()
|
||||
public function find(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('delete', PRIV_SERVICES)) {
|
||||
|
@ -170,7 +170,7 @@ class Services extends EA_Controller
|
|||
/**
|
||||
* Update a service.
|
||||
*/
|
||||
public function update()
|
||||
public function update(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('edit', PRIV_SERVICES)) {
|
||||
|
@ -216,7 +216,7 @@ class Services extends EA_Controller
|
|||
/**
|
||||
* Remove a service.
|
||||
*/
|
||||
public function destroy()
|
||||
public function destroy(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('delete', PRIV_SERVICES)) {
|
||||
|
|
|
@ -38,7 +38,7 @@ class Unavailabilities extends EA_Controller
|
|||
/**
|
||||
* Filter unavailabilities by the provided keyword.
|
||||
*/
|
||||
public function search()
|
||||
public function search(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('view', PRIV_APPOINTMENTS)) {
|
||||
|
@ -64,7 +64,7 @@ class Unavailabilities extends EA_Controller
|
|||
/**
|
||||
* Store a new unavailability.
|
||||
*/
|
||||
public function store()
|
||||
public function store(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('add', PRIV_APPOINTMENTS)) {
|
||||
|
@ -109,7 +109,7 @@ class Unavailabilities extends EA_Controller
|
|||
/**
|
||||
* Find an unavailability.
|
||||
*/
|
||||
public function find()
|
||||
public function find(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('view', PRIV_APPOINTMENTS)) {
|
||||
|
@ -129,7 +129,7 @@ class Unavailabilities extends EA_Controller
|
|||
/**
|
||||
* Update a unavailability.
|
||||
*/
|
||||
public function update()
|
||||
public function update(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('edit', PRIV_APPOINTMENTS)) {
|
||||
|
@ -160,7 +160,7 @@ class Unavailabilities extends EA_Controller
|
|||
/**
|
||||
* Remove a unavailability.
|
||||
*/
|
||||
public function destroy()
|
||||
public function destroy(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('delete', PRIV_APPOINTMENTS)) {
|
||||
|
|
|
@ -45,7 +45,7 @@ class Update extends EA_Controller
|
|||
* This method can be used either by loading the page in the browser or by an ajax request. But it will answer with
|
||||
* JSON encoded data.
|
||||
*/
|
||||
public function index()
|
||||
public function index(): void
|
||||
{
|
||||
try {
|
||||
$user_id = session('user_id');
|
||||
|
|
|
@ -34,7 +34,7 @@ class User extends EA_Controller
|
|||
/**
|
||||
* Redirect to the login page.
|
||||
*/
|
||||
public function index()
|
||||
public function index(): void
|
||||
{
|
||||
redirect('login');
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ class Webhooks extends EA_Controller
|
|||
* On this page admin users will be able to manage webhooks, which are eventually selected by customers during the
|
||||
* booking process.
|
||||
*/
|
||||
public function index()
|
||||
public function index(): void
|
||||
{
|
||||
session(['dest_url' => site_url('webhooks')]);
|
||||
|
||||
|
@ -97,7 +97,7 @@ class Webhooks extends EA_Controller
|
|||
/**
|
||||
* Filter webhooks by the provided keyword.
|
||||
*/
|
||||
public function search()
|
||||
public function search(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('view', PRIV_WEBHOOKS)) {
|
||||
|
@ -123,7 +123,7 @@ class Webhooks extends EA_Controller
|
|||
/**
|
||||
* Store a new webhook.
|
||||
*/
|
||||
public function store()
|
||||
public function store(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('add', PRIV_WEBHOOKS)) {
|
||||
|
@ -155,7 +155,7 @@ class Webhooks extends EA_Controller
|
|||
/**
|
||||
* Update a webhook.
|
||||
*/
|
||||
public function update()
|
||||
public function update(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('edit', PRIV_WEBHOOKS)) {
|
||||
|
@ -188,7 +188,7 @@ class Webhooks extends EA_Controller
|
|||
/**
|
||||
* Remove a webhook.
|
||||
*/
|
||||
public function destroy()
|
||||
public function destroy(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('delete', PRIV_WEBHOOKS)) {
|
||||
|
@ -210,7 +210,7 @@ class Webhooks extends EA_Controller
|
|||
/**
|
||||
* Find a webhook.
|
||||
*/
|
||||
public function find()
|
||||
public function find(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('view', PRIV_WEBHOOKS)) {
|
||||
|
|
|
@ -35,7 +35,7 @@ class Settings_api_v1 extends EA_Controller
|
|||
/**
|
||||
* Get a setting collection.
|
||||
*/
|
||||
public function index()
|
||||
public function index(): void
|
||||
{
|
||||
try {
|
||||
$keyword = $this->api->request_keyword();
|
||||
|
|
|
@ -76,7 +76,7 @@ class Admins_model extends EA_Model
|
|||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function validate(array $admin)
|
||||
public function validate(array $admin): void
|
||||
{
|
||||
// If an admin ID is provided then check whether the record really exists in the database.
|
||||
if (!empty($admin['id'])) {
|
||||
|
@ -277,7 +277,7 @@ class Admins_model extends EA_Model
|
|||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
protected function save_settings(int $admin_id, array $settings)
|
||||
protected function save_settings(int $admin_id, array $settings): void
|
||||
{
|
||||
if (empty($settings)) {
|
||||
throw new InvalidArgumentException('The settings argument cannot be empty.');
|
||||
|
@ -302,7 +302,7 @@ class Admins_model extends EA_Model
|
|||
* @param string $name Setting name.
|
||||
* @param mixed|null $value Setting value.
|
||||
*/
|
||||
public function set_setting(int $admin_id, string $name, mixed $value = null)
|
||||
public function set_setting(int $admin_id, string $name, mixed $value = null): void
|
||||
{
|
||||
if (!$this->db->update('user_settings', [$name => $value], ['id_users' => $admin_id])) {
|
||||
throw new RuntimeException('Could not set the new admin setting value: ' . $name);
|
||||
|
@ -534,7 +534,7 @@ class Admins_model extends EA_Model
|
|||
*
|
||||
* @param array $admin Admin data.
|
||||
*/
|
||||
public function api_encode(array &$admin)
|
||||
public function api_encode(array &$admin): void
|
||||
{
|
||||
$encoded_resource = [
|
||||
'id' => array_key_exists('id', $admin) ? (int) $admin['id'] : null,
|
||||
|
@ -565,7 +565,7 @@ class Admins_model extends EA_Model
|
|||
* @param array $admin API resource.
|
||||
* @param array|null $base Base admin data to be overwritten with the provided values (useful for updates).
|
||||
*/
|
||||
public function api_decode(array &$admin, array $base = null)
|
||||
public function api_decode(array &$admin, array $base = null): void
|
||||
{
|
||||
$decoded_resource = $base ?? [];
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ class Blocked_periods_model extends EA_Model
|
|||
* @return int Returns the blocked-period ID.
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
* @throws Exception
|
||||
*/
|
||||
public function save(array $blocked_period): int
|
||||
{
|
||||
|
@ -64,8 +65,9 @@ class Blocked_periods_model extends EA_Model
|
|||
* @param array $blocked_period Associative array with the blocked-period data.
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
* @throws Exception
|
||||
*/
|
||||
public function validate(array $blocked_period)
|
||||
public function validate(array $blocked_period): void
|
||||
{
|
||||
// If a blocked-period ID is provided then check whether the record really exists in the database.
|
||||
if (!empty($blocked_period['id'])) {
|
||||
|
@ -301,7 +303,7 @@ class Blocked_periods_model extends EA_Model
|
|||
*
|
||||
* @param array $blocked_period Blocked period data.
|
||||
*/
|
||||
public function api_encode(array &$blocked_period)
|
||||
public function api_encode(array &$blocked_period): void
|
||||
{
|
||||
$encoded_resource = [
|
||||
'id' => array_key_exists('id', $blocked_period) ? (int) $blocked_period['id'] : null,
|
||||
|
@ -320,7 +322,7 @@ class Blocked_periods_model extends EA_Model
|
|||
* @param array $blocked_period API resource.
|
||||
* @param array|null $base Base blocked-period data to be overwritten with the provided values (useful for updates).
|
||||
*/
|
||||
public function api_decode(array &$blocked_period, array $base = null)
|
||||
public function api_decode(array &$blocked_period, array $base = null): void
|
||||
{
|
||||
$decoded_resource = $base ?: [];
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ class Consents_model extends EA_Model
|
|||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function validate(array $consent)
|
||||
public function validate(array $consent): void
|
||||
{
|
||||
if (empty($consent['ip']) || empty($consent['type'])) {
|
||||
throw new InvalidArgumentException('Not all required fields are provided: ' . print_r($consent, true));
|
||||
|
|
|
@ -82,7 +82,7 @@ class Customers_model extends EA_Model
|
|||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function validate(array $customer)
|
||||
public function validate(array $customer): void
|
||||
{
|
||||
// If a customer ID is provided then check whether the record really exists in the database.
|
||||
if (!empty($customer['id'])) {
|
||||
|
@ -443,7 +443,7 @@ class Customers_model extends EA_Model
|
|||
*
|
||||
* @param array $customer Customer data.
|
||||
*/
|
||||
public function api_encode(array &$customer)
|
||||
public function api_encode(array &$customer): void
|
||||
{
|
||||
$encoded_resource = [
|
||||
'id' => array_key_exists('id', $customer) ? (int) $customer['id'] : null,
|
||||
|
@ -472,7 +472,7 @@ class Customers_model extends EA_Model
|
|||
* @param array $customer API resource.
|
||||
* @param array|null $base Base customer data to be overwritten with the provided values (useful for updates).
|
||||
*/
|
||||
public function api_decode(array &$customer, array $base = null)
|
||||
public function api_decode(array &$customer, array $base = null): void
|
||||
{
|
||||
$decoded_resource = $base ?: [];
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ class Roles_model extends EA_Model
|
|||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function validate(array $role)
|
||||
public function validate(array $role): void
|
||||
{
|
||||
// If a role ID is provided then check whether the record really exists in the database.
|
||||
if (!empty($role['id'])) {
|
||||
|
|
|
@ -76,7 +76,7 @@ class Secretaries_model extends EA_Model
|
|||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function validate(array $secretary)
|
||||
public function validate(array $secretary): void
|
||||
{
|
||||
// If a secretary ID is provided then check whether the record really exists in the database.
|
||||
if (!empty($secretary['id'])) {
|
||||
|
@ -306,7 +306,7 @@ class Secretaries_model extends EA_Model
|
|||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
protected function save_settings(int $secretary_id, array $settings)
|
||||
protected function save_settings(int $secretary_id, array $settings): void
|
||||
{
|
||||
if (empty($settings)) {
|
||||
throw new InvalidArgumentException('The settings argument cannot be empty.');
|
||||
|
@ -331,7 +331,7 @@ class Secretaries_model extends EA_Model
|
|||
* @param string $name Setting name.
|
||||
* @param mixed|null $value Setting value.
|
||||
*/
|
||||
public function set_setting(int $secretary_id, string $name, mixed $value = null)
|
||||
public function set_setting(int $secretary_id, string $name, mixed $value = null): void
|
||||
{
|
||||
if (!$this->db->update('user_settings', [$name => $value], ['id_users' => $secretary_id])) {
|
||||
throw new RuntimeException('Could not set the new secretary setting value: ' . $name);
|
||||
|
@ -387,7 +387,7 @@ class Secretaries_model extends EA_Model
|
|||
* @param int $secretary_id Secretary ID.
|
||||
* @param array $provider_ids Provider IDs.
|
||||
*/
|
||||
protected function save_provider_ids(int $secretary_id, array $provider_ids)
|
||||
protected function save_provider_ids(int $secretary_id, array $provider_ids): void
|
||||
{
|
||||
// Re-insert the secretary-provider connections.
|
||||
$this->db->delete('secretaries_providers', ['id_users_secretary' => $secretary_id]);
|
||||
|
@ -554,7 +554,7 @@ class Secretaries_model extends EA_Model
|
|||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function load(array &$secretary, array $resources)
|
||||
public function load(array &$secretary, array $resources): void
|
||||
{
|
||||
if (empty($secretary) || empty($resources)) {
|
||||
return;
|
||||
|
@ -581,7 +581,7 @@ class Secretaries_model extends EA_Model
|
|||
*
|
||||
* @param array $secretary Secretary data.
|
||||
*/
|
||||
public function api_encode(array &$secretary)
|
||||
public function api_encode(array &$secretary): void
|
||||
{
|
||||
$encoded_resource = [
|
||||
'id' => array_key_exists('id', $secretary) ? (int) $secretary['id'] : null,
|
||||
|
@ -613,7 +613,7 @@ class Secretaries_model extends EA_Model
|
|||
* @param array $secretary API resource.
|
||||
* @param array|null $base Base secretary data to be overwritten with the provided values (useful for updates).
|
||||
*/
|
||||
public function api_decode(array &$secretary, array $base = null)
|
||||
public function api_decode(array &$secretary, array $base = null): void
|
||||
{
|
||||
$decoded_resource = $base ?: [];
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ class Service_categories_model extends EA_Model
|
|||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function validate(array $service_category)
|
||||
public function validate(array $service_category): void
|
||||
{
|
||||
// If a service-category ID is provided then check whether the record really exists in the database.
|
||||
if (!empty($service_category['id'])) {
|
||||
|
@ -297,7 +297,7 @@ class Service_categories_model extends EA_Model
|
|||
*
|
||||
* @param array $service_category Category data.
|
||||
*/
|
||||
public function api_encode(array &$service_category)
|
||||
public function api_encode(array &$service_category): void
|
||||
{
|
||||
$encoded_resource = [
|
||||
'id' => array_key_exists('id', $service_category) ? (int) $service_category['id'] : null,
|
||||
|
@ -316,7 +316,7 @@ class Service_categories_model extends EA_Model
|
|||
* @param array $service_category API resource.
|
||||
* @param array|null $base Base service-category data to be overwritten with the provided values (useful for updates).
|
||||
*/
|
||||
public function api_decode(array &$service_category, array $base = null)
|
||||
public function api_decode(array &$service_category, array $base = null): void
|
||||
{
|
||||
$decoded_resource = $base ?: [];
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ class Services_model extends EA_Model
|
|||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function validate(array $service)
|
||||
public function validate(array $service): void
|
||||
{
|
||||
// If a service ID is provided then check whether the record really exists in the database.
|
||||
if (!empty($service['id'])) {
|
||||
|
@ -380,7 +380,7 @@ class Services_model extends EA_Model
|
|||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function load(array &$service, array $resources)
|
||||
public function load(array &$service, array $resources): void
|
||||
{
|
||||
if (empty($service) || empty($resources)) {
|
||||
return;
|
||||
|
@ -405,7 +405,7 @@ class Services_model extends EA_Model
|
|||
*
|
||||
* @param array $service Service data.
|
||||
*/
|
||||
public function api_encode(array &$service)
|
||||
public function api_encode(array &$service): void
|
||||
{
|
||||
$encoded_resource = [
|
||||
'id' => array_key_exists('id', $service) ? (int) $service['id'] : null,
|
||||
|
@ -430,7 +430,7 @@ class Services_model extends EA_Model
|
|||
* @param array $service API resource.
|
||||
* @param array|null $base Base service data to be overwritten with the provided values (useful for updates).
|
||||
*/
|
||||
public function api_decode(array &$service, array $base = null)
|
||||
public function api_decode(array &$service, array $base = null): void
|
||||
{
|
||||
$decoded_resource = $base ?: [];
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ class Settings_model extends EA_Model
|
|||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function validate(array $setting)
|
||||
public function validate(array $setting): void
|
||||
{
|
||||
// If a setting ID is provided then check whether the record really exists in the database.
|
||||
if (!empty($setting['id'])) {
|
||||
|
@ -288,7 +288,7 @@ class Settings_model extends EA_Model
|
|||
*
|
||||
* @param array $setting Setting data.
|
||||
*/
|
||||
public function api_encode(array &$setting)
|
||||
public function api_encode(array &$setting): void
|
||||
{
|
||||
$encoded_resource = [
|
||||
'name' => $setting['name'],
|
||||
|
@ -304,7 +304,7 @@ class Settings_model extends EA_Model
|
|||
* @param array $setting API resource.
|
||||
* @param array|null $base Base setting data to be overwritten with the provided values (useful for updates).
|
||||
*/
|
||||
public function api_decode(array &$setting, array $base = null)
|
||||
public function api_decode(array &$setting, array $base = null): void
|
||||
{
|
||||
$decoded_resource = $base ?: [];
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ class Unavailabilities_model extends EA_Model
|
|||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function validate(array $unavailability)
|
||||
public function validate(array $unavailability): void
|
||||
{
|
||||
// If an unavailability ID is provided then check whether the record really exists in the database.
|
||||
if (!empty($unavailability['id'])) {
|
||||
|
@ -349,7 +349,7 @@ class Unavailabilities_model extends EA_Model
|
|||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function load(array &$unavailability, array $resources)
|
||||
public function load(array &$unavailability, array $resources): void
|
||||
{
|
||||
if (empty($unavailability) || empty($resources)) {
|
||||
return;
|
||||
|
@ -374,7 +374,7 @@ class Unavailabilities_model extends EA_Model
|
|||
*
|
||||
* @param array $unavailability Unavailability data.
|
||||
*/
|
||||
public function api_encode(array &$unavailability)
|
||||
public function api_encode(array &$unavailability): void
|
||||
{
|
||||
$encoded_resource = [
|
||||
'id' => array_key_exists('id', $unavailability) ? (int) $unavailability['id'] : null,
|
||||
|
@ -399,7 +399,7 @@ class Unavailabilities_model extends EA_Model
|
|||
* @param array $unavailability API resource.
|
||||
* @param array|null $base Base unavailability data to be overwritten with the provided values (useful for updates).
|
||||
*/
|
||||
public function api_decode(array &$unavailability, array $base = null)
|
||||
public function api_decode(array &$unavailability, array $base = null): void
|
||||
{
|
||||
$decoded_request = $base ?: [];
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ class Users_model extends EA_Model
|
|||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function validate(array $user)
|
||||
public function validate(array $user): void
|
||||
{
|
||||
// If a user ID is provided then check whether the record really exists in the database.
|
||||
if (!empty($user['id'])) {
|
||||
|
@ -138,7 +138,7 @@ class Users_model extends EA_Model
|
|||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
protected function save_settings(int $user_id, array $settings)
|
||||
protected function save_settings(int $user_id, array $settings): void
|
||||
{
|
||||
if (empty($settings)) {
|
||||
throw new InvalidArgumentException('The settings argument cannot be empty.');
|
||||
|
@ -163,7 +163,7 @@ class Users_model extends EA_Model
|
|||
* @param string $name Setting name.
|
||||
* @param string $value Setting value.
|
||||
*/
|
||||
public function set_setting(int $user_id, string $name, string $value)
|
||||
public function set_setting(int $user_id, string $name, string $value): void
|
||||
{
|
||||
if (!$this->db->update('user_settings', [$name => $value], ['id_users' => $user_id])) {
|
||||
throw new RuntimeException('Could not set the new user setting value: ' . $name);
|
||||
|
|
|
@ -70,7 +70,7 @@ class Webhooks_model extends EA_Model
|
|||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function validate(array $webhook)
|
||||
public function validate(array $webhook): void
|
||||
{
|
||||
if (empty($webhook['name']) || empty($webhook['url']) || empty($webhook['actions'])) {
|
||||
throw new InvalidArgumentException('Not all required fields are provided: ' . print_r($webhook, true));
|
||||
|
@ -304,7 +304,7 @@ class Webhooks_model extends EA_Model
|
|||
* @param array $webhook API resource.
|
||||
* @param array|null $base Base webhook data to be overwritten with the provided values (useful for updates).
|
||||
*/
|
||||
public function api_decode(array &$webhook, array $base = null)
|
||||
public function api_decode(array &$webhook, array $base = null): void
|
||||
{
|
||||
$decoded_resource = $base ?: [];
|
||||
|
||||
|
|
Loading…
Reference in a new issue