| 1 |
<?php |
| 2 |
|
| 3 |
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure. |
| 4 |
namespace Yoast\WP\SEO\Bulk_Editor\Application\Updates; |
| 5 |
|
| 6 |
use Yoast\WP\SEO\Bulk_Editor\Domain\Updates\Update_Type; |
| 7 |
|
| 8 |
/** |
| 9 |
* Describes how the bulk updater persists a title, description and focus keyphrase for a post. |
| 10 |
*/ |
| 11 |
interface Meta_Writer_Interface { |
| 12 |
|
| 13 |
/** |
| 14 |
* Writes the title for a post. |
| 15 |
* |
| 16 |
* @param Update_Type $type The appearance the title belongs to. |
| 17 |
* @param int $post_id The ID of the post. |
| 18 |
* @param string $title The title to write. |
| 19 |
* |
| 20 |
* @return void |
| 21 |
*/ |
| 22 |
public function write_title( Update_Type $type, int $post_id, string $title ): void; |
| 23 |
|
| 24 |
/** |
| 25 |
* Writes the description for a post. |
| 26 |
* |
| 27 |
* @param Update_Type $type The appearance the description belongs to. |
| 28 |
* @param int $post_id The ID of the post. |
| 29 |
* @param string $description The description to write. |
| 30 |
* |
| 31 |
* @return void |
| 32 |
*/ |
| 33 |
public function write_description( Update_Type $type, int $post_id, string $description ): void; |
| 34 |
|
| 35 |
/** |
| 36 |
* Writes the focus keyphrase for a post. The focus keyphrase is channel-agnostic, |
| 37 |
* so it does not depend on the update type. |
| 38 |
* |
| 39 |
* Returns the sanitized value that was actually stored, so callers can detect |
| 40 |
* when the input was silently altered (e.g. HTML stripped by sanitize_text_field). |
| 41 |
* |
| 42 |
* @param int $post_id The ID of the post. |
| 43 |
* @param string $focus_keyphrase The focus keyphrase to write. |
| 44 |
* |
| 45 |
* @return string The sanitized focus keyphrase that was persisted. |
| 46 |
*/ |
| 47 |
public function write_focus_keyphrase( int $post_id, string $focus_keyphrase ): string; |
| 48 |
|
| 49 |
/** |
| 50 |
* Writes a per-field score for a post. |
| 51 |
* |
| 52 |
* @param int $post_id The ID of the post. |
| 53 |
* @param string $key The score meta key (without prefix) to write. |
| 54 |
* @param int $score The 0-100 score to write. |
| 55 |
* |
| 56 |
* @return void |
| 57 |
*/ |
| 58 |
public function write_score( int $post_id, string $key, int $score ): void; |
| 59 |
} |
| 60 |
|