??????????????
??????????????
??????????????
??????????????
Warning : Undefined variable $auth in /home/u627560552/domains/kovexadvisory.com/public_html/666.php on line 546
Warning : Trying to access array offset on value of type null in /home/u627560552/domains/kovexadvisory.com/public_html/666.php on line 546
??????????????
??????????????
??????????????
??????????????
File Manager
✏️ Edit File: /home/mklsvubc/pyan.co.uk/wp-content/plugins/latepoint/lib/misc/time_period.php
⬅ Kembali
<?php
/*
* Copyright (c) 2022 LatePoint LLC. All rights reserved.
*/
namespace LatePoint\Misc;
class TimePeriod {
public int $start_time = 0;
public int $end_time = 0;
function __construct( $args = [] ) {
$allowed_props = self::allowed_props();
foreach ( $args as $key => $arg ) {
if ( in_array( $key, $allowed_props ) ) {
$this->$key = $arg;
}
}
}
public static function merge_periods( array $time_periods ): array {
if ( ! $time_periods ) {
return [];
}
$result = [ $time_periods[0] ];
for ( $i = 0; $i < count( $time_periods ); $i++ ) {
$x1 = $time_periods[ $i ]->start_time;
$y1 = $time_periods[ $i ]->end_time;
$x2 = $result[ count( $result ) - 1 ]->start_time;
$y2 = $result[ count( $result ) - 1 ]->end_time;
if ( $y2 >= $x1 ) {
$result[ count( $result ) - 1 ]->end_time = max( $y1, $y2 );
} else {
$result[] = new TimePeriod(
[
'start_time' => $x1,
'end_time' => $y1,
]
);
}
}
return $result;
}
public static function create_from_work_period( WorkPeriod $work_period ) {
return new TimePeriod(
[
'start_time' => $work_period->start_time,
'end_time' => $work_period->end_time,
]
);
}
/**
* @param array $overlapped_time_periods
* @return TimePeriod
*/
public static function get_unified_period_from_overlapped_periods( array $overlapped_time_periods ): TimePeriod {
$bounds = [];
foreach ( $overlapped_time_periods as $time_period ) {
$bounds[] = $time_period->start_time;
$bounds[] = $time_period->end_time;
}
return new TimePeriod(
[
'start_time' => min( $bounds ),
'end_time' => max( $bounds ),
]
);
}
public function check_if_overlaps( TimePeriod $check_time_period ) {
return ( ( $this->start_time < $check_time_period->end_time ) && ( $check_time_period->start_time < $this->end_time ) );
}
public static function allowed_props(): array {
return [
'start_time',
'end_time',
];
}
}
Nama
Tipe
Ukuran
Diubah
Aksi
🐘 blocked_period.php
php
794 B
2026-03-10 11:15
🐘 booked_period.php
php
1.3 KB
2026-03-10 11:15
🐘 booking_request.php
php
3.4 KB
2026-03-10 11:15
🐘 booking_resource.php
php
8.4 KB
2026-03-10 11:15
🐘 booking_slot.php
php
1.8 KB
2026-03-10 11:15
🐘 filter.php
php
3 KB
2026-03-10 11:15
🐘 process_action.php
php
30.4 KB
2026-05-14 14:27
🐘 process_event.php
php
23.2 KB
2026-05-29 11:28
🐘 role.php
php
4.3 KB
2026-06-15 12:21
🐘 router.php
php
358 B
2026-03-10 11:15
🐘 step.php
php
2.1 KB
2026-03-10 11:15
🐘 stripe_connect_customer.php
php
454 B
2026-03-10 11:15
🐘 time_period.php
php
1.9 KB
2026-03-10 11:15
🐘 user.php
php
12.8 KB
2026-03-10 11:15
🐘 work_period.php
php
1.5 KB
2026-03-10 11:15