Skip to content

Commit

Permalink
Use non-abbreviated variable names in od_url_metric_collected action
Browse files Browse the repository at this point in the history
  • Loading branch information
westonruter committed Oct 3, 2024
1 parent 942b397 commit b833e1b
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions plugins/optimization-detective/storage/rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function od_register_endpoint(): void {
function od_handle_rest_request( WP_REST_Request $request ) {
$post = OD_URL_Metrics_Post_Type::get_post( $request->get_param( 'slug' ) );

$group_collection = new OD_URL_Metric_Group_Collection(
$url_metric_group_collection = new OD_URL_Metric_Group_Collection(
$post instanceof WP_Post ? OD_URL_Metrics_Post_Type::get_url_metrics_from_post( $post ) : array(),
od_get_breakpoint_max_widths(),
od_get_url_metrics_breakpoint_sample_size(),
Expand All @@ -111,13 +111,13 @@ function od_handle_rest_request( WP_REST_Request $request ) {

// Block the request if URL metrics aren't needed for the provided viewport width.
try {
$group = $group_collection->get_group_for_viewport_width(
$url_metric_group = $url_metric_group_collection->get_group_for_viewport_width(
$request->get_param( 'viewport' )['width']
);
} catch ( InvalidArgumentException $exception ) {
return new WP_Error( 'invalid_viewport_width', $exception->getMessage() );
}
if ( $group->is_complete() ) {
if ( $url_metric_group->is_complete() ) {
return new WP_Error(
'url_metric_group_complete',
__( 'The URL metric group for the provided viewport is already complete.', 'optimization-detective' ),
Expand Down Expand Up @@ -179,11 +179,11 @@ function od_handle_rest_request( WP_REST_Request $request ) {
* @param array $context {
* Context about the successful URL Metric collection.
*
* @var int $post_id
* @var WP_REST_Request<array<string, mixed>> $request
* @var OD_Strict_URL_Metric $url_metric
* @var OD_URL_Metric_Group $group
* @var OD_URL_Metric_Group_Collection $group_collection
* @type int $post_id ID for URL metrics post.
* @type WP_REST_Request<array<string, mixed>> $request Storage request.
* @type OD_Strict_URL_Metric $url_metric URL metric.
* @type OD_URL_Metric_Group $url_metric_group URL metric group.
* @type OD_URL_Metric_Group_Collection $url_metric_group_collection URL metric group collection.
* }
*/
do_action(
Expand All @@ -192,8 +192,8 @@ function od_handle_rest_request( WP_REST_Request $request ) {
'post_id' => $post_id,
'request' => $request,
'url_metric' => $url_metric,
'url_metric_group' => $group,
'url_metric_group_collection' => $group_collection,
'url_metric_group' => $url_metric_group,
'url_metric_group_collection' => $url_metric_group_collection,
)
);

Expand Down

0 comments on commit b833e1b

Please sign in to comment.