# booktics/1.0.2/core/appointment/schedule/default-only-strategy.php

Booktics – Appointment Booking Calendar for Service Businesses, version 1.0.2. 46 lines.

- Page: https://pluginprobe.com/plugins/booktics/1.0.2/code/core/appointment/schedule/default-only-strategy.php
- Raw: https://pluginprobe.com/plugins/booktics/1.0.2/raw/core/appointment/schedule/default-only-strategy.php
- Modified: 2025-07-10T05:36:58+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/booktics/1.0.2/code/core/appointment/schedule/default-only-strategy.php#L10-L20`.

```php
<?php
namespace Booktics\Appointment\Schedule;

/**
 * Strategy that generates time slots based only on the default schedule entry.
 * This class implements the Time_Slot_Strategy interface and provides a basic
 * slot generation algorithm that ignores service and team member schedules.
 */
class Default_Only_Strategy implements Time_Slot_Strategy {
    /**
     * Generates time slots based on the default schedule entry only.
     *
     * @param Schedule_Entry|null $service_entry The service schedule entry (not used)
     * @param Schedule_Entry|null $team_entry The team member schedule entry (not used)
     * @param Schedule_Entry|null $default_entry The default schedule entry
     * @param Time_Slot_Manager $manager The time slot manager instance
     * @param \DateTime $date The date for which to generate slots
     *
     * @return array Array of Time_Slot objects representing available time slots
     */
    public function generate_slots(
        ?Schedule_Entry $service_entry,
        ?Schedule_Entry $team_entry,
        ?Schedule_Entry $default_entry,
        Time_Slot_Manager $manager,
        \DateTime $date
    ): array {
        if (!$default_entry || $default_entry->is_holiday()) {
            return [];
        }
        $start_time = strtotime($default_entry->get_start_time());
        $end_time   = strtotime($default_entry->get_end_time());
        $duration   = $manager->get_slot_length() * 60;
        $slots      = [];

        while ($start_time + $duration <= $end_time) {
            $slot_start = gmdate('H:i', $start_time);
            $slot_end   = gmdate('H:i', $start_time + $duration);

            $slots[]    = new Time_Slot($slot_start, $slot_end, true);
            $start_time += $duration;
        }

        return $slots;
    }
}
```
