PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.5
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.5
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-feature.php

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

81 lines 1.8 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 single Analysis feature and if it is enabled.
8 */
9 class Analysis_Feature {
10
11 /**
12 * If the feature is enabled.
13 *
14 * @var bool
15 */
16 private $is_enabled;
17
18 /**
19 * What the identifier of the feature is.
20 *
21 * @var string
22 */
23 private $name;
24
25 /**
26 * What the identifier is for the old script data array.
27 *
28 * @var string
29 */
30 private $legacy_key;
31
32 /**
33 * The constructor.
34 *
35 * @param bool $is_enabled If the feature is enabled.
36 * @param string $name What the identifier of the feature is.
37 * @param string $legacy_key What the identifier is for the old script data array.
38 */
39 public function __construct( bool $is_enabled, string $name, string $legacy_key ) {
40 $this->is_enabled = $is_enabled;
41 $this->name = $name;
42 $this->legacy_key = $legacy_key;
43 }
44
45 /**
46 * If the feature is enabled.
47 *
48 * @return bool If the feature is enabled.
49 */
50 public function is_enabled(): bool {
51 return $this->is_enabled;
52 }
53
54 /**
55 * Gets the identifier.
56 *
57 * @return string The feature identifier.
58 */
59 public function get_name(): string {
60 return $this->name;
61 }
62
63 /**
64 * Return this object represented by a key value array.
65 *
66 * @return array<string, bool> Returns the name and if the feature is enabled.
67 */
68 public function to_array(): array {
69 return [ $this->name => $this->is_enabled ];
70 }
71
72 /**
73 * Returns this object represented by a key value structure that is compliant with the script data array.
74 *
75 * @return array<string, bool> Returns the legacy key and if the feature is enabled.
76 */
77 public function to_legacy_array(): array {
78 return [ $this->legacy_key => $this->is_enabled ];
79 }
80 }
81