Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
fix phpcs issues
Browse files Browse the repository at this point in the history
  • Loading branch information
senadir committed Sep 19, 2023
1 parent 27924f4 commit b761a2a
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/Domain/Services/JetpackWooCommerceAnalytics.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,16 @@ private function get_nested_blocks( $blocks, $exclude = array() ) {
return $additional_blocks;
}

public function track_local_pickup( $served, $result, $request, $server ) {
if ( $request->get_route() !== '/wp/v2/settings' ) {
/**
* Track local pickup settings changes via Store API
*
* @param bool $served
* @param \WP_REST_Response $result
* @param \WP_REST_Request $request
* @return bool
*/
public function track_local_pickup( $served, $result, $request ) {
if ( '/wp/v2/settings' !== $request->get_route() ) {
return $served;
}
// Param name here comes from the show_in_rest['name'] value when registering the setting.
Expand All @@ -356,17 +364,17 @@ public function track_local_pickup( $served, $result, $request, $server ) {
$locations = $request->get_param( 'pickup_locations' );

$data = array(
'local_pickup_enabled' => $settings['enabled'] === 'yes' ? true : false,
'local_pickup_enabled' => 'yes' === $settings['enabled'] ? true : false,
'title' => $settings['title'],
'price' => $settings['cost'] === '',
'cost' => $settings['cost'] === '' ? 0 : $settings['cost'],
'price' => '' === $settings['cost'],
'cost' => '' === $settings['cost'] ? 0 : $settings['cost'],
'taxes' => $settings['tax_status'],
'total_pickup_locations' => count( $locations ),
'pickup_locations_enabled' => count(
array_filter(
$locations,
function( $location ) {
return $location['enabled'] === 'yes'; }
return 'yes' === $location['enabled']; }
)
),
);
Expand Down

0 comments on commit b761a2a

Please sign in to comment.