PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.6
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.6
28.6 28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 All 130 releases
wordpress-seo / src / schema-aggregator / infrastructure / schema_map / schema-map-repository-factory.php

schema-map-repository-factory.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 28.6, at src/schema-aggregator/infrastructure/schema_map/schema-map-repository-factory.php

53 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure.
3 namespace Yoast\WP\SEO\Schema_Aggregator\Infrastructure\Schema_Map;
4
5 /**
6 * Factory for getting the amount of posts per post type.
7 */
8 class Schema_Map_Repository_Factory {
9
10 /**
11 * The native indexable repository.
12 *
13 * @var Schema_Map_Indexable_Repository
14 */
15 private $native_repository;
16
17 /**
18 * The WordPress indexable repository.
19 *
20 * @var Schema_Map_WordPress_Repository
21 */
22 private $wordpress_repository;
23
24 /**
25 * Constructor.
26 *
27 * @param Schema_Map_Indexable_Repository $native_repository The native indexable repository.
28 * @param Schema_Map_WordPress_Repository $wordpress_repository The WordPress indexable repository.
29 */
30 public function __construct(
31 Schema_Map_Indexable_Repository $native_repository,
32 Schema_Map_WordPress_Repository $wordpress_repository
33 ) {
34 $this->native_repository = $native_repository;
35 $this->wordpress_repository = $wordpress_repository;
36 }
37
38 /**
39 * Gets the appropriate indexable repository based on availability.
40 *
41 * @param bool $indexables_available Whether native indexables are available.
42 *
43 * @return Schema_Map_Repository_Interface The selected indexable repository.
44 */
45 public function get_repository( bool $indexables_available ): Schema_Map_Repository_Interface {
46 if ( $indexables_available ) {
47 return $this->native_repository;
48 }
49
50 return $this->wordpress_repository;
51 }
52 }
53