PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 27.6
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v27.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 19.0 All 129 releases
wordpress-seo / src / schema-aggregator / infrastructure / elements-context-map / elements-context-map-repository.php

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

56 lines 1.2 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\Elements_Context_Map;
4
5 /**
6 * Repository for the elements-context map.
7 */
8 class Elements_Context_Map_Repository implements Elements_Context_Map_Repository_Interface {
9
10 /**
11 * The elements-context map.
12 *
13 * @var array<array<string, string>>|null
14 */
15 private $map = null;
16
17 /**
18 * The map loader strategy.
19 *
20 * @var Map_Loader_Interface
21 */
22 private $map_loader;
23
24 /**
25 * Constructor.
26 *
27 * @param Map_Loader_Interface $map_loader The map loader strategy.
28 */
29 public function __construct( Map_Loader_Interface $map_loader ) {
30 $this->map_loader = $map_loader;
31 }
32
33 /**
34 * Retrieves the elements-context map.
35 *
36 * @return array<array<string, string>> The elements context-map.
37 */
38 public function get_map(): array {
39 $this->map ??= $this->map_loader->load();
40 return $this->map;
41 }
42
43 /**
44 * Saves the elements-context map.
45 *
46 * @codeCoverageIgnore -- This is just a setter.
47 *
48 * @param array<array<string, string>> $map The elements-context map to besaved.
49 *
50 * @return void
51 */
52 public function save_map( array $map ): void {
53 $this->map = $map;
54 }
55 }
56