PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / trunk
Yoast SEO – Advanced SEO with real-time guidance and built-in AI vtrunk
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 / bulk-editor / domain / updates / post-score-update.php

post-score-update.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI trunk, at src/bulk-editor/domain/updates/post-score-update.php

92 lines 2.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\Bulk_Editor\Domain\Updates;
5
6 /**
7 * Describes a per-post update of the SEO title and/or meta description score.
8 *
9 * A score is null when it is not part of the update, so an update can carry either or both scores.
10 */
11 class Post_Score_Update {
12
13 /**
14 * The ID of the post to update.
15 *
16 * @var int
17 */
18 private $post_id;
19
20 /**
21 * The SEO title score, or null when it is not part of this update.
22 *
23 * @var int|null
24 */
25 private $seo_title_score;
26
27 /**
28 * The meta description score, or null when it is not part of this update.
29 *
30 * @var int|null
31 */
32 private $meta_description_score;
33
34 /**
35 * The constructor.
36 *
37 * @param int $post_id The ID of the post to update.
38 * @param int|null $seo_title_score The SEO title score, or null when not part of this update.
39 * @param int|null $meta_description_score The meta description score, or null when not part of this update.
40 */
41 public function __construct( int $post_id, ?int $seo_title_score, ?int $meta_description_score ) {
42 $this->post_id = $post_id;
43 $this->seo_title_score = $seo_title_score;
44 $this->meta_description_score = $meta_description_score;
45 }
46
47 /**
48 * Gets the ID of the post to update.
49 *
50 * @return int The ID of the post to update.
51 */
52 public function get_post_id(): int {
53 return $this->post_id;
54 }
55
56 /**
57 * Whether this update carries an SEO title score.
58 *
59 * @return bool Whether this update carries an SEO title score.
60 */
61 public function has_seo_title_score(): bool {
62 return $this->seo_title_score !== null;
63 }
64
65 /**
66 * Gets the SEO title score.
67 *
68 * @return int|null The SEO title score, or null when not part of this update.
69 */
70 public function get_seo_title_score(): ?int {
71 return $this->seo_title_score;
72 }
73
74 /**
75 * Whether this update carries a meta description score.
76 *
77 * @return bool Whether this update carries a meta description score.
78 */
79 public function has_meta_description_score(): bool {
80 return $this->meta_description_score !== null;
81 }
82
83 /**
84 * Gets the meta description score.
85 *
86 * @return int|null The meta description score, or null when not part of this update.
87 */
88 public function get_meta_description_score(): ?int {
89 return $this->meta_description_score;
90 }
91 }
92