Skip to content

Commit

Permalink
Move top page data in the search rankings directory
Browse files Browse the repository at this point in the history
  • Loading branch information
leonidasmi committed Jan 27, 2025
1 parent 0a7f913 commit de92bcc
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public function get_seo_score_group( ?int $seo_score ): SEO_Score_Groups_Interfa
}
}

// @TODO: Consider throwing an exception here, when we deal with error handling.
return new No_SEO_Score_Group();
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<?php
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure.
namespace Yoast\WP\SEO\Dashboard\Domain\Top_Pages;
namespace Yoast\WP\SEO\Dashboard\Domain\Search_Rankings;

use Yoast\WP\SEO\Dashboard\Domain\Data_Provider\Data_Interface;
use Yoast\WP\SEO\Dashboard\Domain\Score_Groups\SEO_Score_Groups\SEO_Score_Groups_Interface;
use Yoast\WP\SEO\Dashboard\Domain\Search_Rankings\Search_Data;

/**
* Domain object that represents a single Top Page Data record.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

use Yoast\WP\SEO\Dashboard\Application\Score_Groups\SEO_Score_Groups\SEO_Score_Groups_Repository;
use Yoast\WP\SEO\Dashboard\Domain\Data_Provider\Data_Container;
use Yoast\WP\SEO\Dashboard\Domain\Top_Pages\Top_Page_Data;
use Yoast\WP\SEO\Dashboard\Domain\Search_Rankings\Top_Page_Data;
use Yoast\WP\SEO\Repositories\Indexable_Repository;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public function get_rankings( WP_REST_Request $request ): WP_REST_Response {
$this->request_parameters->set_start_date( $date->format( 'Y-m-d' ) );
$this->request_parameters->set_end_date( ( new DateTime( 'now', new DateTimeZone( 'UTC' ) ) )->format( 'Y-m-d' ) );

$search_data_container = $this->search_rankings_repository->get_data( $this->request_parameters );
$search_rankings_container = $this->search_rankings_repository->get_data( $this->request_parameters );

} catch ( Exception $exception ) {
return new WP_REST_Response(
Expand All @@ -150,7 +150,7 @@ public function get_rankings( WP_REST_Request $request ): WP_REST_Response {
}

return new WP_REST_Response(
$search_data_container->to_array(),
$search_rankings_container->to_array(),
200
);
}
Expand Down

0 comments on commit de92bcc

Please sign in to comment.