From 5e81b8d2afdc7c6cd665cfdc693bc566bd537ca5 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Thu, 16 Jun 2022 23:00:56 +0200 Subject: [PATCH] Cleanup: Simplification and removed dead code and duplicated/outdated declarations --- .../public_dashboard_controller.php | 4 +- includes/controller/shifts_controller.php | 4 +- .../user_driver_licenses_controller.php | 2 +- .../controller/user_worklog_controller.php | 2 +- includes/controller/users_controller.php | 10 +- includes/engelsystem.php | 1 + includes/helper/email_helper.php | 2 +- includes/model/ShiftsFilter.php | 6 +- includes/model/Shifts_model.php | 4 +- includes/model/UserDriverLicenses_model.php | 130 ------------------ includes/model/UserWorkLog_model.php | 1 - includes/pages/admin_active.php | 2 +- includes/pages/admin_free.php | 2 +- includes/pages/admin_groups.php | 5 +- includes/pages/admin_shifts.php | 8 +- includes/pages/admin_user.php | 4 +- includes/pages/schedule/ImportSchedule.php | 23 ++-- includes/pages/user_myshifts.php | 2 +- includes/sys_form.php | 20 +-- includes/sys_page.php | 6 +- includes/sys_template.php | 2 +- includes/view/PublicDashboard_view.php | 2 +- includes/view/Rooms_view.php | 2 +- includes/view/ShiftCalendarRenderer.php | 10 +- includes/view/ShiftCalendarShiftRenderer.php | 1 - includes/view/UserDriverLicenses_view.php | 2 +- includes/view/User_view.php | 12 +- 27 files changed, 64 insertions(+), 205 deletions(-) delete mode 100644 includes/model/UserDriverLicenses_model.php diff --git a/includes/controller/public_dashboard_controller.php b/includes/controller/public_dashboard_controller.php index 9d3b02b9..72fdd18c 100644 --- a/includes/controller/public_dashboard_controller.php +++ b/includes/controller/public_dashboard_controller.php @@ -81,7 +81,7 @@ function public_dashboard_controller_free_shift($shift, ShiftsFilter $filter = n 'shifttype_name' => $shifttype['name'], 'title' => $shift['title'], 'room_name' => $room->name, - 'needed_angels' => [] + 'needed_angels' => public_dashboard_needed_angels($shift['NeedAngels'], $filter), ]; if (time() + 3 * 60 * 60 > $shift['start']) { @@ -91,8 +91,6 @@ function public_dashboard_controller_free_shift($shift, ShiftsFilter $filter = n $free_shift['style'] = 'danger'; } - $free_shift['needed_angels'] = public_dashboard_needed_angels($shift['NeedAngels'], $filter); - return $free_shift; } diff --git a/includes/controller/shifts_controller.php b/includes/controller/shifts_controller.php index d5fe7db4..78bf85c8 100644 --- a/includes/controller/shifts_controller.php +++ b/includes/controller/shifts_controller.php @@ -17,9 +17,7 @@ function shift_link($shift) $parameters['shift_id'] = $shift['SID']; } - $link = page_link_to('shifts', $parameters); - - return $link; + return page_link_to('shifts', $parameters); } /** diff --git a/includes/controller/user_driver_licenses_controller.php b/includes/controller/user_driver_licenses_controller.php index 8c83601f..26a1aa3f 100644 --- a/includes/controller/user_driver_licenses_controller.php +++ b/includes/controller/user_driver_licenses_controller.php @@ -40,7 +40,7 @@ function user_driver_licenses_controller() $user = auth()->user(); if (!$user) { - throw_redirect(page_link_to('')); + throw_redirect(page_link_to()); } $action = strip_request_item('action', 'edit'); diff --git a/includes/controller/user_worklog_controller.php b/includes/controller/user_worklog_controller.php index 4ede1d9c..a9b02a4b 100644 --- a/includes/controller/user_worklog_controller.php +++ b/includes/controller/user_worklog_controller.php @@ -87,7 +87,7 @@ function user_worklog_from_request(Worklog $worklog) } $worklog->hours = $request->input('work_hours'); - if (!preg_match("/^[0-9]+(\.[0-9]{0,2})?$/", $worklog->hours)) { + if (!preg_match("/^\d+(\.\d{0,2})?$/", $worklog->hours)) { $valid = false; error(__('Please enter work hours in format ##[.##].')); } diff --git a/includes/controller/users_controller.php b/includes/controller/users_controller.php index 656ecdec..fcdb3fcc 100644 --- a/includes/controller/users_controller.php +++ b/includes/controller/users_controller.php @@ -19,7 +19,7 @@ function users_controller() $request = request(); if (!$user) { - throw_redirect(page_link_to('')); + throw_redirect(page_link_to()); } $action = 'list'; @@ -58,7 +58,7 @@ function user_delete_controller() } if (!auth()->can('admin_user')) { - throw_redirect(page_link_to('')); + throw_redirect(page_link_to()); } // You cannot delete yourself @@ -150,7 +150,7 @@ function user_edit_vouchers_controller() (!auth()->can('admin_user') && !auth()->can('voucher.edit')) || !config('enable_voucher') ) { - throw_redirect(page_link_to('')); + throw_redirect(page_link_to()); } if ($request->hasPostData('submit')) { @@ -266,7 +266,7 @@ function users_list_controller() $request = request(); if (!auth()->can('admin_user')) { - throw_redirect(page_link_to('')); + throw_redirect(page_link_to()); } $order_by = 'name'; @@ -385,8 +385,6 @@ function shiftCalendarRendererByShiftFilter(ShiftsFilter $shiftsFilter) $filtered_shifts = []; foreach ($shifts as $shift) { $needed_angels_count = 0; - $taken = 0; - foreach ($needed_angeltypes[$shift['SID']] as $needed_angeltype) { $taken = 0; diff --git a/includes/engelsystem.php b/includes/engelsystem.php index acd45f77..b156c68a 100644 --- a/includes/engelsystem.php +++ b/includes/engelsystem.php @@ -18,6 +18,7 @@ require __DIR__ . '/includes.php'; /** * Check for maintenance */ +/** @var \Engelsystem\Application $app */ if ($app->get('config')->get('maintenance')) { http_response_code(503); $url = $app->get(UrlGeneratorInterface::class); diff --git a/includes/helper/email_helper.php b/includes/helper/email_helper.php index b2473e64..eff64675 100644 --- a/includes/helper/email_helper.php +++ b/includes/helper/email_helper.php @@ -29,7 +29,7 @@ function engelsystem_email_to_user($recipientUser, $title, $message, $notIfItsMe $translator->setLocale($recipientUser->settings->language); $mailer->sendView( - $recipientUser->contact->email ? $recipientUser->contact->email : $recipientUser->email, + $recipientUser->contact->email ?: $recipientUser->email, $title, 'emails/mail', ['username' => $recipientUser->name, 'message' => $message] diff --git a/includes/model/ShiftsFilter.php b/includes/model/ShiftsFilter.php index c3811977..65f7024b 100644 --- a/includes/model/ShiftsFilter.php +++ b/includes/model/ShiftsFilter.php @@ -27,13 +27,13 @@ class ShiftsFilter private $userShiftsAdmin; /** @var int[] */ - private $filled = []; + private $filled; /** @var int[] */ - private $rooms = []; + private $rooms; /** @var int[] */ - private $types = []; + private $types; /** @var int unix timestamp */ private $startTime = null; diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php index 232987ca..43fc63b7 100644 --- a/includes/model/Shifts_model.php +++ b/includes/model/Shifts_model.php @@ -375,8 +375,8 @@ function Shift_signup_allowed_angel( if ( empty($user_angeltype) - || ($angeltype['no_self_signup'] == 1 && !empty($user_angeltype)) - || ($angeltype['restricted'] == 1 && !empty($user_angeltype) && !isset($user_angeltype['confirm_user_id'])) + || $angeltype['no_self_signup'] == 1 + || ($angeltype['restricted'] == 1 && !isset($user_angeltype['confirm_user_id'])) ) { // you cannot join if user is not of this angel type // you cannot join if you are not confirmed diff --git a/includes/model/UserDriverLicenses_model.php b/includes/model/UserDriverLicenses_model.php deleted file mode 100644 index 181e631b..00000000 --- a/includes/model/UserDriverLicenses_model.php +++ /dev/null @@ -1,130 +0,0 @@ - null, - 'has_car' => false, - 'has_license_car' => false, - 'has_license_3_5t_transporter' => false, - 'has_license_7_5t_truck' => false, - 'has_license_12_5t_truck' => false, - 'has_license_forklift' => false - ]; -} - -/** - * Is it valid? - * - * @param array $user_driver_license The UserDriverLicense to check - * @return boolean - */ -function UserDriverLicense_valid($user_driver_license) -{ - return - $user_driver_license['has_license_car'] - || $user_driver_license['has_license_3_5t_transporter'] - || $user_driver_license['has_license_7_5t_truck'] - || $user_driver_license['has_license_12_5t_truck'] - || $user_driver_license['has_license_forklift']; -} - -/** - * Get a users driver license information - * - * @param int $user_id The users id - * @return array|null - */ -function UserDriverLicense($user_id) -{ - $driverLicense = DB::selectOne(' - SELECT * - FROM `UserDriverLicenses` - WHERE `user_id`=?', [$user_id]); - - return empty($driverLicense) ? null : $driverLicense; -} - -/** - * Create a user's driver license entry - * - * @param array $user_driver_license The UserDriverLicense to create - * @param int $userId - * @return array - */ -function UserDriverLicenses_create($user_driver_license, $userId) -{ - $user_driver_license['user_id'] = $userId; - DB::insert(' - INSERT INTO `UserDriverLicenses` ( - `user_id`, - `has_car`, - `has_license_car`, - `has_license_3_5t_transporter`, - `has_license_7_5t_truck`, - `has_license_12_5t_truck`, - `has_license_forklift` - ) - VALUES (?, ?, ?, ?, ?, ?, ?) - ', - [ - $user_driver_license['user_id'], - (int)$user_driver_license['has_car'], - (int)$user_driver_license['has_license_car'], - (int)$user_driver_license['has_license_3_5t_transporter'], - (int)$user_driver_license['has_license_7_5t_truck'], - (int)$user_driver_license['has_license_12_5t_truck'], - (int)$user_driver_license['has_license_forklift'], - ] - ); - - return $user_driver_license; -} - -/** - * Update a user's driver license entry - * - * @param array $user_driver_license The UserDriverLicense to update - */ -function UserDriverLicenses_update($user_driver_license) -{ - DB::update(' - UPDATE `UserDriverLicenses` - SET - `has_car`=?, - `has_license_car`=?, - `has_license_3_5t_transporter`=?, - `has_license_7_5t_truck`=?, - `has_license_12_5t_truck`=?, - `has_license_forklift`=? - WHERE `user_id`=? - ', - [ - (int)$user_driver_license['has_car'], - (int)$user_driver_license['has_license_car'], - (int)$user_driver_license['has_license_3_5t_transporter'], - (int)$user_driver_license['has_license_7_5t_truck'], - (int)$user_driver_license['has_license_12_5t_truck'], - (int)$user_driver_license['has_license_forklift'], - $user_driver_license['user_id'], - ] - ); -} - -/** - * Delete a user's driver license entry - * - * @param int $user_id - */ -function UserDriverLicenses_delete($user_id) -{ - DB::delete('DELETE FROM `UserDriverLicenses` WHERE `user_id`=?', [$user_id]); -} diff --git a/includes/model/UserWorkLog_model.php b/includes/model/UserWorkLog_model.php index 56f3b104..e00a4c03 100644 --- a/includes/model/UserWorkLog_model.php +++ b/includes/model/UserWorkLog_model.php @@ -2,7 +2,6 @@ use Carbon\Carbon; use Engelsystem\Models\Room; -use Engelsystem\Models\User\User; use Engelsystem\Models\Worklog; use Illuminate\Support\Collection; diff --git a/includes/pages/admin_active.php b/includes/pages/admin_active.php index f4be148e..14cf8d5f 100644 --- a/includes/pages/admin_active.php +++ b/includes/pages/admin_active.php @@ -306,7 +306,7 @@ function admin_active() form_submit('submit', __('Search')) ], page_link_to('admin_active')), $set_active == '' ? form([ - form_text('count', __('How much angels should be active?'), $count ? $count : $forced_count), + form_text('count', __('How much angels should be active?'), $count ?: $forced_count), form_submit('set_active', __('Preview')) ]) : $set_active, $msg . msg(), diff --git a/includes/pages/admin_free.php b/includes/pages/admin_free.php index 29226289..7710ba80 100644 --- a/includes/pages/admin_free.php +++ b/includes/pages/admin_free.php @@ -91,7 +91,7 @@ function admin_free() } } - $email = ($usr->contact->email ? $usr->contact->email : $usr->email); + $email = $usr->contact->email ?: $usr->email; $free_users_table[] = [ 'name' => User_Nick_render($usr) . User_Pronoun_render($usr), 'shift_state' => User_shift_state_render($usr), diff --git a/includes/pages/admin_groups.php b/includes/pages/admin_groups.php index d6a25eb1..c43135e1 100644 --- a/includes/pages/admin_groups.php +++ b/includes/pages/admin_groups.php @@ -123,14 +123,11 @@ function admin_groups() $group = Db::selectOne('SELECT * FROM `Groups` WHERE `UID`=? LIMIT 1', [$group_id]); $privileges = $request->request->all('privileges'); - if (!is_array($privileges)) { - $privileges = []; - } if (!empty($group)) { Db::delete('DELETE FROM `GroupPrivileges` WHERE `group_id`=?', [$group_id]); $privilege_names = []; foreach ($privileges as $privilege) { - if (preg_match('/^\d{1,}$/', $privilege)) { + if (preg_match('/^\d+$/', $privilege)) { $group_privileges_source = Db::selectOne( 'SELECT `name` FROM `Privileges` WHERE `id`=? LIMIT 1', [$privilege] diff --git a/includes/pages/admin_shifts.php b/includes/pages/admin_shifts.php index 7bf75f10..bb6eda00 100644 --- a/includes/pages/admin_shifts.php +++ b/includes/pages/admin_shifts.php @@ -27,8 +27,8 @@ function admin_shifts() $session = session(); $start = Carbon::createTimestampFromDatetime(date('Y-m-d') . 'T00:00'); $end = $start; - $mode = 'single'; - $angelmode = 'manually'; + $mode = ''; + $angelmode = ''; $length = ''; $change_hours = []; $title = ''; @@ -452,7 +452,7 @@ function admin_shifts() div('col-md-6', [ form_datetime('start', __('Start'), $start), form_datetime('end', __('End'), $end), - form_info(__('Mode'), ''), + form_info(__('Mode')), form_radio('mode', __('Create one shift'), $mode == 'single', 'single'), form_radio('mode', __('Create multiple shifts'), $mode == 'multi', 'multi'), form_text( @@ -482,7 +482,7 @@ function admin_shifts() ) ]), div('col-md-6', [ - form_info(__('Needed angels'), ''), + form_info(__('Needed angels')), form_radio( 'angelmode', __('Take needed angels from room settings'), diff --git a/includes/pages/admin_user.php b/includes/pages/admin_user.php index 3f3dcc31..df715b98 100644 --- a/includes/pages/admin_user.php +++ b/includes/pages/admin_user.php @@ -44,7 +44,7 @@ function admin_user() . page_link_to('admin_user', ['action' => 'save', 'id' => $user_id]) . '" method="post">' . "\n"; $html .= form_csrf(); - $html .= '' . "\n"; + $html .= '
' . "\n"; $html .= '' . "\n"; $html .= ''; + $html .= '
' . "\n"; $html .= '' . "\n"; @@ -100,7 +100,7 @@ function admin_user() $html .= ' ' . "\n"; - $html .= '
T-Shirt' . "\n"; $html .= html_options('eTshirt', $options, $user_source->state->got_shirt) . '
' . "\n" . '
' . "\n" . ''; $html .= '' . "\n"; $html .= '' . "\n" . '
' . "\n"; diff --git a/includes/pages/schedule/ImportSchedule.php b/includes/pages/schedule/ImportSchedule.php index e5210837..27380099 100644 --- a/includes/pages/schedule/ImportSchedule.php +++ b/includes/pages/schedule/ImportSchedule.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace Engelsystem\Controllers\Admin\Schedule; use Carbon\Carbon; +use DateTimeInterface; use Engelsystem\Controllers\BaseController; use Engelsystem\Controllers\HasUserNotifications; use Engelsystem\Helpers\Schedule\Event; @@ -247,7 +248,7 @@ class ImportSchedule extends BaseController foreach ($newEvents as $event) { $this->createEvent( $event, - (int)$shiftType, + $shiftType, $rooms ->where('name', $event->getRoom()->getName()) ->first(), @@ -258,7 +259,7 @@ class ImportSchedule extends BaseController foreach ($changeEvents as $event) { $this->updateEvent( $event, - (int)$shiftType, + $shiftType, $rooms ->where('name', $event->getRoom()->getName()) ->first() @@ -326,8 +327,8 @@ class ImportSchedule extends BaseController [ 'shift' => $shift->getTitle(), 'room' => $room->name, - 'from' => $shift->getDate()->format(Carbon::RFC3339), - 'to' => $shift->getEndDate()->format(Carbon::RFC3339), + 'from' => $shift->getDate()->format(DateTimeInterface::RFC3339), + 'to' => $shift->getEndDate()->format(DateTimeInterface::RFC3339), 'guid' => $shift->getGuid(), ] ); @@ -364,8 +365,8 @@ class ImportSchedule extends BaseController [ 'shift' => $shift->getTitle(), 'room' => $room->name, - 'from' => $shift->getDate()->format(Carbon::RFC3339), - 'to' => $shift->getEndDate()->format(Carbon::RFC3339), + 'from' => $shift->getDate()->format(DateTimeInterface::RFC3339), + 'to' => $shift->getEndDate()->format(DateTimeInterface::RFC3339), 'guid' => $shift->getGuid(), ] ); @@ -386,8 +387,8 @@ class ImportSchedule extends BaseController 'Deleted schedule shift "{shift}" ({from} {to}, {guid})', [ 'shift' => $shift->getTitle(), - 'from' => $shift->getDate()->format(Carbon::RFC3339), - 'to' => $shift->getEndDate()->format(Carbon::RFC3339), + 'from' => $shift->getDate()->format(DateTimeInterface::RFC3339), + 'to' => $shift->getEndDate()->format(DateTimeInterface::RFC3339), 'guid' => $shift->getGuid(), ] ); @@ -395,7 +396,7 @@ class ImportSchedule extends BaseController /** * @param Request $request - * @return Event[]|Room[]|RoomModel[]|ScheduleUrl|Schedule|string + * @return Event[]|Room[]|RoomModel[] * @throws ErrorException */ protected function getScheduleData(Request $request) @@ -528,7 +529,7 @@ class ImportSchedule extends BaseController $end = Carbon::createFromTimestamp($shift->end); $duration = $start->diff($end); - $event = new Event( + return new Event( $scheduleShift->guid, 0, new Room($shift->room_name), @@ -542,8 +543,6 @@ class ImportSchedule extends BaseController '', '' ); - - return $event; } /** diff --git a/includes/pages/user_myshifts.php b/includes/pages/user_myshifts.php index 29a196da..b25ba51d 100644 --- a/includes/pages/user_myshifts.php +++ b/includes/pages/user_myshifts.php @@ -24,7 +24,7 @@ function user_myshifts() if ( $request->has('id') && auth()->can('user_shifts_admin') - && preg_match('/^\d{1,}$/', $request->input('id')) + && preg_match('/^\d+$/', $request->input('id')) && User::find($request->input('id')) ) { $shift_entry_id = $request->input('id'); diff --git a/includes/sys_form.php b/includes/sys_form.php index 2b9e52c6..06f72f45 100644 --- a/includes/sys_form.php +++ b/includes/sys_form.php @@ -39,11 +39,11 @@ function form_spinner($name, $label, $value) @@ -55,7 +55,7 @@ function form_spinner($name, $label, $value) * * @param string $name Name of the parameter * @param string $label Label - * @param int $value Unix Timestamp + * @param int|Carbon $value Unix Timestamp * @param string $start_date Earliest possible date * @param string $end_date * @return string HTML @@ -93,10 +93,12 @@ function form_datetime(string $name, string $label, $value) return form_element($label, sprintf('
-
- ', $dom_id, $name, htmlspecialchars($value ? $value->format('Y-m-d H:i') : ''), $dom_id), $dom_id); + ', $dom_id, $name, htmlspecialchars($value ? $value->format('Y-m-d H:i') : '')), $dom_id); } /** @@ -112,7 +114,7 @@ function form_checkboxes($name, $label, $items, $selected) { $html = form_element($label, ''); foreach ($items as $key => $item) { - $html .= form_checkbox($name . '_' . $key, $item, array_search($key, $selected) !== false); + $html .= form_checkbox($name . '_' . $key, $item, in_array($key, $selected)); } return $html; } @@ -140,8 +142,8 @@ function form_multi_checkboxes($names, $label, $items, $selected, $disabled = [] $dom_id = ''; foreach ($names as $name => $title) { $dom_id = $name . '_' . $key; - $sel = array_search($key, $selected[$name]) !== false ? ' checked="checked"' : ''; - if (!empty($disabled) && !empty($disabled[$name]) && array_search($key, $disabled[$name]) !== false) { + $sel = in_array($key, $selected[$name]) ? ' checked="checked"' : ''; + if (!empty($disabled) && !empty($disabled[$name]) && in_array($key, $disabled[$name])) { $sel .= ' disabled="disabled"'; } $html .= '' @@ -216,7 +218,7 @@ function form_info($label, $text = '') if ($text == '') { return '

' . $label . '

'; } - return form_element($label, '

' . $text . '

', ''); + return form_element($label, '

' . $text . '

'); } /** diff --git a/includes/sys_page.php b/includes/sys_page.php index 1a1dc218..4597caaa 100644 --- a/includes/sys_page.php +++ b/includes/sys_page.php @@ -173,7 +173,7 @@ function check_date($input, $error_message = null, $null_allowed = false, $time_ * Returns REQUEST value filtered or default value (null) if not set. * * @param string $name - * @param string $default_value + * @param string|null $default_value * @return mixed|null */ function strip_request_item($name, $default_value = null) @@ -215,7 +215,7 @@ function strip_request_item_nl($name, $default_value = null) if ($request->has($name)) { // Only allow letters, symbols, punctuation, separators, numbers and newlines without html tags return preg_replace( - "/([^\p{L}\p{S}\p{P}\p{Z}\p{N}+\n]{1,})/ui", + "/([^\p{L}\p{S}\p{P}\p{Z}\p{N}+\n]+)/ui", '', strip_tags($request->input($name)) ); @@ -232,7 +232,7 @@ function strip_request_item_nl($name, $default_value = null) function strip_item($item) { // Only allow letters, symbols, punctuation, separators and numbers without html tags - return preg_replace("/([^\p{L}\p{S}\p{P}\p{Z}\p{N}+]{1,})/ui", '', strip_tags($item)); + return preg_replace("/([^\p{L}\p{S}\p{P}\p{Z}\p{N}+]+)/ui", '', strip_tags($item)); } /** diff --git a/includes/sys_template.php b/includes/sys_template.php index 9585202a..cf51b291 100644 --- a/includes/sys_template.php +++ b/includes/sys_template.php @@ -110,7 +110,7 @@ function progress_bar($valuemin, $valuemax, $valuenow, $class = '', $content = ' . 'aria-valuenow="' . $valuenow . '" aria-valuemin="' . $valuemin . '" aria-valuemax="' . $valuemax . '" ' . 'style="width: ' . floor(($valuenow - $valuemin) * 100 / ($valuemax - $valuemin)) . '%"' . '>' - . $content . '' + . $content . '' . ''; } diff --git a/includes/view/PublicDashboard_view.php b/includes/view/PublicDashboard_view.php index 3f51619b..a4a9944a 100644 --- a/includes/view/PublicDashboard_view.php +++ b/includes/view/PublicDashboard_view.php @@ -23,7 +23,7 @@ function public_dashboard_view($stats, $free_shifts) $shift_panels[] = ''; $needed_angels = div('first', [ div('col-md-12', [ - heading(__('Needed angels:'), 1) + heading(__('Needed angels:')) ]), div('container-fluid', [ join($shift_panels) diff --git a/includes/view/Rooms_view.php b/includes/view/Rooms_view.php index 10d0f723..a2430729 100644 --- a/includes/view/Rooms_view.php +++ b/includes/view/Rooms_view.php @@ -24,7 +24,7 @@ function Room_view(Room $room, ShiftsFilterRenderer $shiftsFilterRenderer, Shift if ($room->description) { $description = '

' . __('Description') . '

'; $parsedown = new Parsedown(); - $description .= $parsedown->parse((string)$room->description); + $description .= $parsedown->parse($room->description); } $tabs = []; diff --git a/includes/view/ShiftCalendarRenderer.php b/includes/view/ShiftCalendarRenderer.php index 27a82433..9d237a22 100644 --- a/includes/view/ShiftCalendarRenderer.php +++ b/includes/view/ShiftCalendarRenderer.php @@ -34,19 +34,19 @@ class ShiftCalendarRenderer private $shiftsFilter; /** @var int */ - private $firstBlockStartTime = 0; + private $firstBlockStartTime; /** @var int */ - private $lastBlockEndTime = 0; + private $lastBlockEndTime; /** @var int */ private $blocksPerSlot = null; /** @var array[] */ - private $needed_angeltypes = []; + private $needed_angeltypes; /** @var array[] */ - private $shift_entries = []; + private $shift_entries; /** * ShiftCalendarRenderer constructor. @@ -100,7 +100,7 @@ class ShiftCalendarRenderer } } // If all lanes for this room are busy, create a new lane and add shift to it - if ($shift_added == false) { + if (!$shift_added) { $newLane = new ShiftCalendarLane($header, $this->getFirstBlockStartTime(), $this->getBlocksPerSlot()); $newLane->addShift($shift); $lanes[$room_id][] = $newLane; diff --git a/includes/view/ShiftCalendarShiftRenderer.php b/includes/view/ShiftCalendarShiftRenderer.php index 43465a97..b8bc74dd 100644 --- a/includes/view/ShiftCalendarShiftRenderer.php +++ b/includes/view/ShiftCalendarShiftRenderer.php @@ -5,7 +5,6 @@ namespace Engelsystem; use Engelsystem\Models\Room; use Engelsystem\Models\User\User; -use function config; use function theme_type; /** diff --git a/includes/view/UserDriverLicenses_view.php b/includes/view/UserDriverLicenses_view.php index e2e18d3c..c9056982 100644 --- a/includes/view/UserDriverLicenses_view.php +++ b/includes/view/UserDriverLicenses_view.php @@ -54,7 +54,7 @@ function UserDriverLicense_edit_view($user_source, $user_driver_license) '