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

Booktics – Appointment Booking Calendar for Service Businesses, version 1.0.20. 56 lines.

- Page: https://pluginprobe.com/plugins/booktics/1.0.20/code/core/appointment/schedule/default-only-strategy.php
- Raw: https://pluginprobe.com/plugins/booktics/1.0.20/raw/core/appointment/schedule/default-only-strategy.php
- Modified: 2026-04-29T04:49:04+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.20/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(
        array $service_entries,
        array $team_entries,
        array $default_entries,
        Time_Slot_Manager $manager,
        \DateTime $date
    ): array {
        $slots = array();
        if ( ! empty( $default_entries ) ) {
            foreach ( $default_entries as $default_entry ) {
                if ( ! $default_entry || $default_entry->is_holiday() ) {
                    continue;
                }
                $start_time = strtotime( $default_entry->get_start_time() );
                $end_time   = strtotime( $default_entry->get_end_time() );
                $slot_length = $manager->get_slot_length() * 60;
                $service_duration = $manager->get_service_duration() * 60;
                $before_buffer = $manager->get_before_buffer_time() * 60;
                $after_buffer  = $manager->get_after_buffer_time() * 60;
                $gap = $before_buffer + $after_buffer;
                $current_start = $start_time;
                while ( $current_start + $service_duration <= $end_time ) {
                    $slot_start = gmdate( 'H:i', $current_start );
                    $slot_end   = gmdate( 'H:i', $current_start + $service_duration );
                    $max_capacity = $manager->get_service_max_capacity_for_timeslot(); // Get max capacity from group booking

                    $slots[]    = new Time_Slot( $slot_start, $slot_end, true, $max_capacity );

                    $current_start += $slot_length + $gap;
                }
            }
        }
        return $slots;
    }
}

```
