PATH:
home
/
ediuae
/
petalwellnessspa.com
/
wp-content
/
plugins
/
simply-schedule-appointments
/
includes
<?php /** * Simply Schedule Appointments Sequence. * * @since 3.6.3 * @package Simply_Schedule_Appointments */ /** * Simply Schedule Appointments Sequence. * * @since 3.6.3 */ use League\Period\Period; class SSA_Sequence implements ArrayAccess, Countable, Iterator { protected $ssa_periods = array(); protected $count = 0; protected $position = 0; /** * Constructor. * * @since 3.6.3 * * @param Simply_Schedule_Appointments $plugin Main plugin object. */ public function __construct( $ssa_periods = array() ) { if ( is_a( $ssa_periods, 'SSA_Period' ) ) { $ssa_periods = array( $ssa_periods ); } $this->ssa_periods = $ssa_periods; } public function raw_periods() { $raw_periods = array(); foreach ($this->ssa_periods as $key => $ssa_period) { $raw_period = $ssa_period->get_raw_period(); if ( ! empty( $raw_period ) ) { $raw_periods[] = $raw_period; } } return $raw_periods; } public function get_ssa_periods() { return $this->ssa_periods; } /** * Returns an instance sorted according to the given comparison callable * but does not maintain index association. * * This method MUST retain the state of the current instance, and return * an instance that contains the sorted ssa_periods. The key are re-indexed */ public function sorted(callable $compare = null) { if ( null === $compare ) { $compare = array( $this, 'sort_by_raw_start_date' ); } $ssa_periods = $this->ssa_periods; usort($ssa_periods, $compare); if ($ssa_periods === $this->ssa_periods) { return $this; } return new self( $ssa_periods ); } /** * Filters the sequence according to the given predicate. * * This method MUST retain the state of the current instance, and return * an instance that contains the interval which validate the predicate. */ public function filter( callable $predicate ) { $ssa_periods = array_filter( $this->ssa_periods, $predicate, ARRAY_FILTER_USE_BOTH ); if ( $ssa_periods === $this->ssa_periods ) { return $this; } return new self( $ssa_periods ); } public function raw_boundaries() { if ( empty( $this->ssa_periods ) ) { return null; } $sequence = $this->sorted( array( $this, 'sort_by_buffered_start_date' ) ); $ssa_periods = $sequence->get_ssa_periods(); $start_date = $ssa_periods[0]->get_raw_period()->getStartDate(); $end_date = array_pop( $ssa_periods )->get_raw_period()->getEndDate(); return new Period( $start_date, $end_date ); } public function buffered_boundaries() { if ( empty( $this->ssa_periods ) ) { return null; } $sequence = $this->sorted( array( $this, 'sort_by_buffered_start_date' ) ); $ssa_periods = $sequence->get_ssa_periods(); $start_date = $ssa_periods[0]->get_full_buffered_period()->getStartDate(); $end_date = array_pop( $ssa_periods )->get_full_buffered_period()->getEndDate(); return new Period( $start_date, $end_date ); } /** * Sorts two Interval instance using their start datepoint. */ private function sort_by_raw_start_date(SSA_Period $interval1, SSA_Period $interval2) { $a = $interval1->get_raw_period()->getStartDate(); $b = $interval2->get_raw_period()->getStartDate(); if ( $a == $b ) { return 0; } else if ( $a < $b ) { return -1; } else if ( $a > $b ) { return 1; } return null; } /** * Sorts two Interval instance using their start datepoint. */ private function sort_by_buffered_start_date(SSA_Period $interval1, SSA_Period $interval2) { $a = $interval1->get_full_buffered_period()->getStartDate(); $b = $interval2->get_full_buffered_period()->getStartDate(); if ( $a == $b ) { return 0; } else if ( $a < $b ) { return -1; } else if ( $a > $b ) { return 1; } return null; } /* ArrayAccess */ public function offsetSet($offset, $value) { if (is_null($offset)) { $this->ssa_periods[] = $value; } else { $this->ssa_periods[$offset] = $value; } } public function offsetExists($offset) { return isset($this->ssa_periods[$offset]); } public function offsetUnset($offset) { unset($this->ssa_periods[$offset]); } public function offsetGet($offset) { return isset($this->ssa_periods[$offset]) ? $this->ssa_periods[$offset] : null; } /* Countable */ public function count() { return $this->count; } /* Iterator */ public function rewind() { $this->position = 0; } public function current() { return $this->ssa_periods[$this->position]; } public function key() { return $this->position; } public function next() { ++$this->position; } public function valid() { return isset($this->ssa_periods[$this->position]); } }
[-] 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]