PATH:
home
/
ediuae
/
petalwellnessspa.com
/
wp-content
/
plugins
/
simply-schedule-appointments
/
includes
<?php /** * Simply Schedule Appointments Availability Block. * * @since 3.6.10 * @package Simply_Schedule_Appointments */ /** * Simply Schedule Appointments Availability Block. * * @since 3.6.10 */ use League\Period\Period; class SSA_Availability_Block { /** * Parent plugin class. * * @since 3.6.10 * * @var Simply_Schedule_Appointments */ protected $plugin = null; protected $period; protected $type; protected $subtype; protected $available_block_id; // if it matches something in the database. We will need to cascade-delete it when reconciling with others. If no protected $appointment_id; protected $appointment_type_id; protected $staff_id; protected $resource_group_id; protected $resource_id; protected $calendar_id; protected $is_available; protected $is_calculated; protected $availability_score; protected $capacity_available = SSA_Constants::CAPACITY_MAX; protected $capacity_reserved = 0; protected $capacity_reserved_delta = 0; protected $buffer_available = SSA_Constants::CAPACITY_MAX; protected $buffer_reserved = 0; protected $buffer_reserved_delta = 0; /** * Constructor. * * @since 3.6.10 * * @param Simply_Schedule_Appointments $plugin Main plugin object. */ public function __construct() { } /** * Magic getter for our object. * * @since 0.0.0 * * @param string $field Field to get. * @throws Exception Throws an exception if the field is invalid. * @return mixed Value of the field. */ public function __get( $field ) { if ( ! property_exists( $this, $field ) ) { throw new Exception( 'Invalid ' . __CLASS__ . ' property: ' . $field ); } return $this->$field; } /** * Magic setter for our object. * * @since 0.0.0 * * @param string $field Field to set. * @throws Exception Throws an exception if the field is invalid. * @return mixed Value of the field. */ public function __set( $field, $value ) { if ( ! property_exists( $this, $field ) ) { throw new Exception( 'Invalid ' . __CLASS__ . ' property: ' . $field ); } $this->$field = $value; } private function get_clone() { $instance = clone $this; return $instance; } public function get_period() { return $this->period; } public function set_period( $period ) { $clone = $this->get_clone(); $clone->period = $period; return $clone; } public function binarize( $gte_threshold = 1 ) { $clone = $this->get_clone(); if( $clone->capacity_available >= $gte_threshold ) { $clone->capacity_available = SSA_Constants::CAPACITY_MAX; $clone->capacity_reserved = 0; } else { $clone->capacity_available = 0; $clone->capacity_reserved = SSA_Constants::CAPACITY_MAX; } if( $clone->buffer_available >= $gte_threshold ) { $clone->buffer_available = SSA_Constants::CAPACITY_MAX; $clone->buffer_reserved = 0; } else { $clone->buffer_available = 0; $clone->buffer_reserved = SSA_Constants::CAPACITY_MAX; } return $clone; } public function set_capacity_reserved( $capacity_reserved ) { if ( $this->capacity_reserved === $capacity_reserved ) { return $this; } $clone = $this->get_clone(); $clone->capacity_reserved = $capacity_reserved; return $clone; } public function set_capacity_available( $capacity_available ) { if ( $this->capacity_available === $capacity_available ) { return $this; } $clone = $this->get_clone(); $clone->capacity_available = $capacity_available; return $clone; } public function set_buffer_reserved( $buffer_reserved ) { if ( $this->buffer_reserved === $buffer_reserved ) { return $this; } $clone = $this->get_clone(); $clone->buffer_reserved = $buffer_reserved; return $clone; } public function set_buffer_available( $buffer_available ) { if ( $this->buffer_available === $buffer_available ) { return $this; } $clone = $this->get_clone(); $clone->buffer_available = $buffer_available; return $clone; } public function is_before( SSA_Availability_Block $another_block ) { return $this->period->isBefore( $another_block->period ); } public function is_before_period( Period $period ) { return $this->period->isBefore( $period ); } public function is_after( SSA_Availability_Block $another_block ) { return $this->period->isAfter( $another_block->period ); } public function is_after_period( Period $period ) { return $this->period->isAfter( $period ); } public function contains( SSA_Availability_Block $another_block ) { return $this->period->contains( $another_block->period ); } public function overlaps( SSA_Availability_Block $another_block ) { return $this->period->overlaps( $another_block->period ); } public function overlaps_period( Period $another_period ) { return $this->period->overlaps( $another_period ); } public function abuts( SSA_Availability_Block $another_block ) { return $this->period->abuts( $another_block->period ); } public function abuts_period( Period $another_period ) { return $this->period->abuts( $another_period ); } public function intersect_period( SSA_Availability_Block $another_block ) { return $this->period->intersect( $another_block->period ); } public function diff_periods( SSA_Availability_Block $another_block ) { return $this->period->diff( $another_block->period ); } public function gap_period( SSA_Availability_Block $another_block ) { return $this->period->gap( $another_block->period ); } public function can_merge( SSA_Availability_Block $another_block ) { if ( ! $this->abuts( $another_block ) ) { return false; } if ( $this == $another_block->set_period( $this->get_period() ) ) { return true; } return false; } public function merge( SSA_Availability_Block $another_block ) { return $this->set_period( $this->get_period()->merge( $another_block->get_period() ) ); } }
[-] class-settings.php
[edit]
[-] class-hooks.php
[edit]
[-] class-availability-query.php
[edit]
[-] class-appointment-model.php
[edit]
[-] class-beaver-builder.php
[edit]
[-] class-web-meetings.php
[edit]
[-] class-availability-model.php
[edit]
[-] class-recipient-admin.php
[edit]
[-] class-recipient-customer.php
[edit]
[-] class-constants.php
[edit]
[-] class-async-action-model.php
[edit]
[-] class-support.php
[edit]
[-] class-google-calendar-client.php
[edit]
[+]
..
[-] class-capabilities.php
[edit]
[-] class-encryption.php
[edit]
[-] class-availability-cache-invalidation.php
[edit]
[-] class-calendar-events-settings.php
[edit]
[-] class-settings-global.php
[edit]
[-] class-translation.php
[edit]
[-] class-cli.php
[edit]
[-] class-missing.php
[edit]
[-] class-action-scheduler.php
[edit]
[-] class-templates-api.php
[edit]
[-] class-blackout-dates.php
[edit]
[-] class-calendar-events-object.php
[edit]
[-] class-divi.php
[edit]
[-] class-templates.php
[edit]
[-] class-wp-admin.php
[edit]
[-] class-appointment-factory.php
[edit]
[-] class-scheduling-max-per-day.php
[edit]
[-] class-notifications-api.php
[edit]
[-] class-shortcodes.php
[edit]
[-] class-validation.php
[edit]
[-] class-resource-group-object-factory.php
[edit]
[-] class-payment-object.php
[edit]
[-] class-locale.php
[edit]
[-] class-ics-exporter.php
[edit]
[-] class-filesystem.php
[edit]
[-] class-recipient-shared.php
[edit]
[-] class-availability-schedule.php
[edit]
[-] class-block-upcoming-appointments.php
[edit]
[-] class-elementor.php
[edit]
[-] class-appointment-meta-model.php
[edit]
[-] class-revision-meta-model.php
[edit]
[+]
divi
[-] class-notifications.php
[edit]
[-] class-upgrade.php
[edit]
[-] class-utils.php
[edit]
[-] class-availability-functions.php
[edit]
[-] class-external-calendar-api.php
[edit]
[-] class-csv-exporter.php
[edit]
[-] class-external-google-calendar-api.php
[edit]
[-] class-twig-extension.php
[edit]
[-] class-bootstrap.php
[edit]
[-] class-notices.php
[edit]
[-] class-availability-schedule-factory.php
[edit]
[-] class-blackout-dates-settings.php
[edit]
[-] class-support-status.php
[edit]
[-] class-block-booking.php
[edit]
[-] class-advanced-scheduling-availability.php
[edit]
[-] class-exception.php
[edit]
[-] class-styles-settings.php
[edit]
[-] class-forms.php
[edit]
[-] class-recipient-staff.php
[edit]
[+]
beaver-builder
[-] class-users.php
[edit]
[-] class-sequence-factory.php
[edit]
[+]
third-party
[-] class-locales.php
[edit]
[-] class-db-model.php
[edit]
[-] class-db.php
[edit]
[-] class-availability-default.php
[edit]
[-] class-staff-settings.php
[edit]
[-] class-notification-model.php
[edit]
[-] class-settings-installed.php
[edit]
[-] class-appointment-object.php
[edit]
[-] class-notices-api.php
[edit]
[-] class-translation-settings.php
[edit]
[-] class-support-status-api.php
[edit]
[-] class-notices-data.php
[edit]
[-] class-appointment-type-object.php
[edit]
[-] class-appointment-type-object-factory.php
[edit]
[-] class-availability-block-factory.php
[edit]
[-] class-recipient.php
[edit]
[-] class-revision-model.php
[edit]
[-] class-customers.php
[edit]
[-] class-settings-api.php
[edit]
[-] class-cache.php
[edit]
[-] class-availability-detective-case.php
[edit]
[-] class-styles.php
[edit]
[-] class-capacity-settings.php
[edit]
[-] class-gcal-exporter.php
[edit]
[-] class-advanced-scheduling-settings.php
[edit]
[-] class-appointment-type-model.php
[edit]
[-] class-notifications-settings.php
[edit]
[-] class-period.php
[edit]
[-] class-external-api.php
[edit]
[-] class-error-notices.php
[edit]
[-] class-availability-cache.php
[edit]
[-] class-developer-settings.php
[edit]
[-] class-dashboard-upcoming-appointments-widget.php
[edit]
[-] class-availability-external-model.php
[edit]
[-] class-availability-block.php
[edit]
[-] class-customer-information.php
[edit]
[+]
elementor
[-] class-appointment-type-label-model.php
[edit]
[-] class-embed-booking-app-api.php
[edit]
[+]
lib
[-] class-sequence.php
[edit]
[-] class-debug.php
[edit]
[-] class-appointment-types-db.php
[edit]