-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTimeSpanInterface.php
More file actions
83 lines (71 loc) · 2.31 KB
/
TimeSpanInterface.php
File metadata and controls
83 lines (71 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
namespace Icecave\Chrono\TimeSpan;
use DateInterval;
use Icecave\Chrono\Interval\IntervalInterface;
use Icecave\Chrono\TimePointInterface;
/**
* A common interface for non-anchored blocks of time (periods and durations).
*/
interface TimeSpanInterface
{
/**
* @return bool True if the time span is zero seconds in length; otherwise, false.
*/
public function isEmpty();
/**
* @return TimeSpanInterface
*/
public function inverse();
/**
* Resolve the time span to a total number of seconds, using the given time point as the start of the span.
*
* @param TimePointInterface $timePoint The start of the time span.
*
* @return int The total number of seconds.
*/
public function resolveToSeconds(TimePointInterface $timePoint);
/**
* Resolve the time span to a {@see Duration}, using the given time point as the start of the span.
*
* @param TimePointInterface $timePoint The start of the time span.
*
* @return Duration
*/
public function resolveToDuration(TimePointInterface $timePoint);
/**
* Resolve the time span to a {@see Period}, using the given time point as the start of the span.
*
* @param TimePointInterface $timePoint The start of the time span.
*
* @return Period
*/
public function resolveToPeriod(TimePointInterface $timePoint);
/**
* Resolve the time span an an {@see IntervalInterface} starting at the given time point, with a length equal to this time span.
*
* @param TimePointInterface $timePoint The start of the interval.
*
* @return IntervalInterface The end of the time span.
*/
public function resolveToInterval(TimePointInterface $timePoint);
/**
* Resolve the time span to a time point after the given time point by the length of this span.
*
* @param TimePointInterface $timePoint The start of the time span.
*
* @return TimePointInterface
*/
public function resolveToTimePoint(TimePointInterface $timePoint);
/**
* @return DateInterval A native PHP DateInterval instance representing this span.
*/
public function nativeDateInterval();
/**
* @return string
*/
public function string();
/**
* @return string
*/
public function __toString();
}