@@ -51,7 +51,7 @@ final class OD_URL_Metric_Group_Collection implements Countable, IteratorAggrega
5151 * value of 1, and the breakpoints are used as the maximum viewport widths for the viewport groups, with the addition of
5252 * a final viewport group which has a maximum viewport width of infinity.
5353 *
54- * This array may be empty in which case there are no responsive breakpoints and all URL Metrics are collected in a
54+ * This array may be empty, in which case there are no responsive breakpoints, and all URL Metrics are collected in a
5555 * single group.
5656 *
5757 * @since 0.1.0
@@ -153,7 +153,7 @@ public function __construct( array $url_metrics, string $current_etag, array $br
153153 */
154154 $ this ->breakpoints = $ breakpoints ;
155155
156- // Set sample size.
156+ // Set the sample size.
157157 if ( $ sample_size <= 0 ) {
158158 throw new InvalidArgumentException (
159159 esc_html (
@@ -211,7 +211,7 @@ public function get_sample_size(): int {
211211 }
212212
213213 /**
214- * Gets the freshness age (TTL) for a given URL Metric..
214+ * Gets the freshness age (TTL) for a given URL Metric.
215215 *
216216 * @since 1.0.0
217217 *
@@ -224,7 +224,7 @@ public function get_freshness_ttl(): int {
224224 /**
225225 * Gets the first URL Metric group (with the lowest minimum viewport width, e.g. for mobile).
226226 *
227- * This group normally represents viewports for mobile devices. This group always has a minimum viewport width of 0
227+ * This group normally represents viewports for mobile devices. This group always has a minimum viewport width of 0,
228228 * and the maximum viewport width corresponds to the smallest defined breakpoint returned by
229229 * {@see od_get_breakpoint_max_widths()}.
230230 *
@@ -241,7 +241,7 @@ public function get_first_group(): OD_URL_Metric_Group {
241241 *
242242 * This group normally represents viewports for desktop devices. This group always has a minimum viewport width
243243 * defined as one greater than the largest breakpoint returned by {@see od_get_breakpoint_max_widths()}.
244- * The maximum viewport width of this group is always `null`, or in other words it is unbounded.
244+ * The maximum viewport width of this group is always `null`, or in other words, it is unbounded.
245245 *
246246 * @since 0.7.0
247247 *
@@ -404,7 +404,7 @@ public function is_every_group_populated(): bool {
404404 /**
405405 * Checks whether every group is complete (full sample of non-stale URL Metrics).
406406 *
407- * Completeness means the full sample size of URL Metrics has been collected,
407+ * Completeness means the full sample size of URL Metrics has been collected;
408408 * none of the collected URL Metrics are stale (with a mismatching ETag or a
409409 * timestamp older than the freshness TTL).
410410 *
@@ -520,9 +520,9 @@ public function get_common_lcp_element(): ?OD_Element {
520520 /**
521521 * Gets all elements from all URL Metrics from all groups keyed by the elements' XPaths.
522522 *
523- * This is an O(n^3) function so its results must be cached. This being said, the number of groups should be 4 (one
524- * more than the default number of breakpoints) and the number of URL Metrics for each group should be 3
525- * (the default sample size). Therefore, given the number (n) of visited elements on the page this will only
523+ * This is an O(n^3) function, so its results must be cached. This being said, the number of groups should be 4 (one
524+ * more than the default number of breakpoints), and the number of URL Metrics for each group should be 3
525+ * (the default sample size). Therefore, given the number (n) of visited elements on the page, this will only
526526 * end up running n*4*3 times.
527527 *
528528 * @since 0.7.0
@@ -584,8 +584,8 @@ public function get_all_element_max_intersection_ratios(): array {
584584 *
585585 * An element is positioned in the initial viewport if its `boundingClientRect.top` is less than the
586586 * `viewport.height` for any of its recorded URL Metrics. Note that even though the element may be positioned in the
587- * initial viewport, it may not actually be visible. It could be occluded as a latter slide in a carousel in which
588- * case it will have intersectionRatio of 0. Or the element may not be visible due to it or an ancestor having the
587+ * initial viewport, it may not actually be visible. It could be occluded as a latter slide in a carousel, in which
588+ * case it will have an intersectionRatio of 0. Or the element may not be visible due to it or an ancestor having the
589589 * `visibility:hidden` style, such as in the case of a dropdown navigation menu. When, for example, an IMG element
590590 * is positioned in any initial viewport, it should not get `loading=lazy` but rather `fetchpriority=low`.
591591 * Furthermore, the element may be positioned _above_ the initial viewport or to the left or right of the viewport,
@@ -624,7 +624,7 @@ public function get_all_elements_positioned_in_any_initial_viewport(): array {
624624 * @since 0.3.0
625625 *
626626 * @param string $xpath XPath for the element.
627- * @return float|null Max intersection ratio of null if tag is unknown (not captured).
627+ * @return float|null Max intersection ratio or null if the tag is unknown (not captured).
628628 */
629629 public function get_element_max_intersection_ratio ( string $ xpath ): ?float {
630630 return $ this ->get_all_element_max_intersection_ratios ()[ $ xpath ] ?? null ;
@@ -636,7 +636,7 @@ public function get_element_max_intersection_ratio( string $xpath ): ?float {
636636 * @since 0.7.0
637637 *
638638 * @param string $xpath XPath for the element.
639- * @return bool|null Whether element is positioned in any initial viewport of null if unknown.
639+ * @return bool|null Whether an element is positioned in any initial viewport or null if unknown.
640640 */
641641 public function is_element_positioned_in_any_initial_viewport ( string $ xpath ): ?bool {
642642 return $ this ->get_all_elements_positioned_in_any_initial_viewport ()[ $ xpath ] ?? null ;
@@ -651,8 +651,8 @@ public function is_element_positioned_in_any_initial_viewport( string $xpath ):
651651 */
652652 public function get_flattened_url_metrics (): array {
653653 // The duplication of iterator_to_array is not a mistake. This collection is an
654- // iterator and the collection contains iterator instances. So to flatten the
655- // two levels of iterators we need to nest calls to iterator_to_array().
654+ // iterator, and the collection contains iterator instances. So to flatten the
655+ // two levels of iterators, we need to nest calls to iterator_to_array().
656656 return array_merge (
657657 ...array_map (
658658 'iterator_to_array ' ,
0 commit comments