PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 27.8
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v27.8
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 / editors / domain / analysis-features / analysis-features-list.php

analysis-features-list.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 27.8, at src/editors/domain/analysis-features/analysis-features-list.php

57 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure.
4 namespace Yoast\WP\SEO\Editors\Domain\Analysis_Features;
5
6 /**
7 * This class describes a list of analysis features.
8 */
9 class Analysis_Features_List {
10
11 /**
12 * The features.
13 *
14 * @var array<Analysis_Feature>
15 */
16 private $features = [];
17
18 /**
19 * Adds an analysis feature to the list.
20 *
21 * @param Analysis_Feature $feature The analysis feature to add.
22 *
23 * @return void
24 */
25 public function add_feature( Analysis_Feature $feature ): void {
26 $this->features[] = $feature;
27 }
28
29 /**
30 * Parses the feature list to a legacy ready array representation.
31 *
32 * @return array<string, bool> The list presented as a key value representation.
33 */
34 public function parse_to_legacy_array(): array {
35 $array = [];
36 foreach ( $this->features as $feature ) {
37 $array = \array_merge( $array, $feature->to_legacy_array() );
38 }
39
40 return $array;
41 }
42
43 /**
44 * Parses the feature list to an array representation.
45 *
46 * @return array<string, bool> The list presented as a key value representation.
47 */
48 public function to_array(): array {
49 $array = [];
50 foreach ( $this->features as $feature ) {
51 $array = \array_merge( $array, $feature->to_array() );
52 }
53
54 return $array;
55 }
56 }
57