@@ -30,19 +30,19 @@ final class DateRange implements DateRangeInterface, JsonSerializable
3030 private $ state ;
3131
3232 /**
33- * @param DateTimeInterface|null $startTime
34- * @param DateTimeInterface|null $endTime
33+ * @param DateTimeInterface|null $startDate
34+ * @param DateTimeInterface|null $endDate
3535 */
36- public function __construct (DateTimeInterface $ startTime = null , DateTimeInterface $ endTime = null )
36+ public function __construct (DateTimeInterface $ startDate = null , DateTimeInterface $ endDate = null )
3737 {
3838 $ state = new UndefinedRange ();
3939
40- if (isset ($ startTime )) {
41- $ state = $ state ->setStartTime ( $ startTime );
40+ if (isset ($ startDate )) {
41+ $ state = $ state ->setStartDate ( $ startDate );
4242 }
4343
44- if (isset ($ endTime )) {
45- $ state = $ state ->setEndTime ( $ endTime );
44+ if (isset ($ endDate )) {
45+ $ state = $ state ->setEndDate ( $ endDate );
4646 }
4747
4848 $ this ->state = $ state ;
@@ -57,8 +57,8 @@ public function __toString(): string
5757 {
5858 return sprintf (
5959 '%s/%s ' ,
60- $ this ->state ->formatStartTime ('c ' ) ?: '- ' ,
61- $ this ->state ->formatEndTime ('c ' ) ?: '- '
60+ $ this ->state ->formatStartDate ('c ' ) ?: '- ' ,
61+ $ this ->state ->formatEndDate ('c ' ) ?: '- '
6262 );
6363 }
6464
@@ -68,11 +68,11 @@ public function __toString(): string
6868 public function __debugInfo ()
6969 {
7070 return [
71- 'startTime ' => $ this ->state ->hasStartTime ()
72- ? $ this ->state ->getStartTime ()
71+ 'startDate ' => $ this ->state ->hasStartDate ()
72+ ? $ this ->state ->getStartDate ()
7373 : null ,
74- 'endTime ' => $ this ->state ->hasEndTime ()
75- ? $ this ->state ->getEndTime ()
74+ 'endDate ' => $ this ->state ->hasEndDate ()
75+ ? $ this ->state ->getEndDate ()
7676 : null ,
7777 ];
7878 }
@@ -87,90 +87,90 @@ public function __debugInfo()
8787 public function jsonSerialize (): array
8888 {
8989 return [
90- 'startTime ' => $ this ->state ->formatStartTime (),
91- 'endTime ' => $ this ->state ->formatEndTime (),
90+ 'startDate ' => $ this ->state ->formatStartDate (),
91+ 'endDate ' => $ this ->state ->formatEndDate (),
9292 ];
9393 }
9494
9595 /**
9696 * {@inheritdoc}
9797 */
98- public function hasStartTime (): bool
98+ public function hasStartDate (): bool
9999 {
100- return $ this ->state ->hasStartTime ();
100+ return $ this ->state ->hasStartDate ();
101101 }
102102
103103 /**
104104 * {@inheritdoc}
105105 */
106- public function hasEndTime (): bool
106+ public function hasEndDate (): bool
107107 {
108- return $ this ->state ->hasEndTime ();
108+ return $ this ->state ->hasEndDate ();
109109 }
110110
111111 /**
112112 * {@inheritdoc}
113113 */
114- public function getStartTime (): DateTimeInterface
114+ public function getStartDate (): DateTimeInterface
115115 {
116- return $ this ->state ->getStartTime ();
116+ return $ this ->state ->getStartDate ();
117117 }
118118
119119 /**
120120 * {@inheritdoc}
121121 */
122- public function getEndTime (): DateTimeInterface
122+ public function getEndDate (): DateTimeInterface
123123 {
124- return $ this ->state ->getEndTime ();
124+ return $ this ->state ->getEndDate ();
125125 }
126126
127127 /**
128128 * {@inheritdoc}
129129 */
130- public function setStartTime (DateTimeInterface $ time ): DateRangeInterface
130+ public function setStartDate (DateTimeInterface $ start ): DateRangeInterface
131131 {
132132 $ clone = clone $ this ;
133- $ clone ->state = $ clone ->state ->setStartTime ( $ time );
133+ $ clone ->state = $ clone ->state ->setStartDate ( $ start );
134134
135135 return $ clone ;
136136 }
137137
138138 /**
139139 * {@inheritdoc}
140140 */
141- public function setEndTime (DateTimeInterface $ time ): DateRangeInterface
141+ public function setEndDate (DateTimeInterface $ end ): DateRangeInterface
142142 {
143143 $ clone = clone $ this ;
144- $ clone ->state = $ clone ->state ->setEndTime ( $ time );
144+ $ clone ->state = $ clone ->state ->setEndDate ( $ end );
145145
146146 return $ clone ;
147147 }
148148
149149 /**
150150 * {@inheritdoc}
151151 */
152- public function isStartedAt (DateTimeInterface $ time ): bool
152+ public function isStartedOn (DateTimeInterface $ date ): bool
153153 {
154- return $ this ->hasStartTime () && $ this ->state ->compareStartTime ( $ time ) === 0 ;
154+ return $ this ->hasStartDate () && $ this ->state ->compareStartDate ( $ date ) === 0 ;
155155 }
156156
157157 /**
158158 * {@inheritdoc}
159159 */
160- public function isEndedAt (DateTimeInterface $ time ): bool
160+ public function isEndedOn (DateTimeInterface $ date ): bool
161161 {
162- return $ this ->hasEndTime () && $ this ->state ->compareEndTime ( $ time ) === 0 ;
162+ return $ this ->hasEndDate () && $ this ->state ->compareEndDate ( $ date ) === 0 ;
163163 }
164164
165165 /**
166166 * {@inheritdoc}
167167 */
168168 public function isStarted (): bool
169169 {
170- if ($ this ->hasStartTime ()) {
171- return $ this ->state ->compareStartTime (new DateTimeImmutable ()) <= 0 ;
170+ if ($ this ->hasStartDate ()) {
171+ return $ this ->state ->compareStartDate (new DateTimeImmutable ()) <= 0 ;
172172 } else {
173- return $ this ->hasEndTime ();
173+ return $ this ->hasEndDate ();
174174 }
175175 }
176176
@@ -179,32 +179,32 @@ public function isStarted(): bool
179179 */
180180 public function isEnded (): bool
181181 {
182- return $ this ->hasEndTime () && $ this ->state ->compareEndTime (new DateTimeImmutable ()) < 0 ;
182+ return $ this ->hasEndDate () && $ this ->state ->compareEndDate (new DateTimeImmutable ()) < 0 ;
183183 }
184184
185185 /**
186186 * {@inheritdoc}
187187 */
188188 public function getDateInterval (): DateInterval
189189 {
190- return $ this ->getStartTime ()->diff ($ this ->getEndTime ());
190+ return $ this ->getStartDate ()->diff ($ this ->getEndDate ());
191191 }
192192
193193 /**
194194 * {@inheritdoc}
195195 */
196196 public function getDatePeriod (DateInterval $ interval , int $ option = 0 ): DatePeriod
197197 {
198- return new DatePeriod ($ this ->getStartTime (), $ interval , $ this ->getEndTime (), $ option );
198+ return new DatePeriod ($ this ->getStartDate (), $ interval , $ this ->getEndDate (), $ option );
199199 }
200200
201201 /**
202202 * {@inheritdoc}
203203 */
204204 public function split (DateInterval $ interval ): Traversable
205205 {
206- $ startDate = $ this ->getStartTime ();
207- $ endDate = $ this ->getEndTime ();
206+ $ startDate = $ this ->getStartDate ();
207+ $ endDate = $ this ->getEndDate ();
208208 $ period = $ this ->getDatePeriod ($ interval , DatePeriod::EXCLUDE_START_DATE );
209209
210210 foreach ($ period as $ date ) {
0 commit comments