Skip to content

Commit 796e684

Browse files
GrotaxCopilot
andcommitted
docs: enhance getNewestItemDate method documentation for clarity and completeness
Small code fixes Co-authored-by: Copilot <[email protected]>
1 parent 566bddd commit 796e684

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/FeedIo/Reader/Result/UpdateStats.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,15 @@ public function getAverageInterval(): int
142142
}
143143

144144
// some feeds could have very old historic
145-
// articles so eliminate them with statistic
145+
// articles so eliminate them using statistical methods
146146
$q1 = $intervals[(int) floor($count * 0.25)];
147147
$q3 = $intervals[(int) floor($count * 0.75)];
148148
$iqr = $q3 - $q1;
149149

150150
$lower_bound = $q1 - 1.5 * $iqr;
151151
$upper_bound = $q3 + 1.5 * $iqr;
152152

153-
$result = array_filter($intervals, function($value) use ($lower_bound, $upper_bound) {
153+
$result = array_filter($intervals, function(int $value) use ($lower_bound, $upper_bound) {
154154
return $value >= $lower_bound && $value <= $upper_bound;
155155
});
156156

@@ -182,7 +182,11 @@ public function getMedianInterval(): int
182182
}
183183

184184
/**
185-
* @return int
185+
* Returns the timestamp of the newest item in the feed.
186+
* The value is capped at the current time to prevent future dates from being used.
187+
* If the feed has no items with valid timestamps, returns the feed's last modified timestamp.
188+
*
189+
* @return int Unix timestamp of the newest item (in seconds since epoch)
186190
*/
187191
public function getNewestItemDate(): int
188192
{

0 commit comments

Comments
 (0)