| 1 |
<?php |
| 2 |
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure. |
| 3 |
namespace Yoast\WP\SEO\Task_List\Domain\Data; |
| 4 |
|
| 5 |
/** |
| 6 |
* Value object representing content item data for the improve default meta descriptions task. |
| 7 |
*/ |
| 8 |
class Meta_Description_Content_Item_Data implements Content_Item_Data_Interface { |
| 9 |
|
| 10 |
/** |
| 11 |
* The content item ID. |
| 12 |
* |
| 13 |
* @var int |
| 14 |
*/ |
| 15 |
private $content_id; |
| 16 |
|
| 17 |
/** |
| 18 |
* The content item title. |
| 19 |
* |
| 20 |
* @var string |
| 21 |
*/ |
| 22 |
private $title; |
| 23 |
|
| 24 |
/** |
| 25 |
* Whether the content item has a custom meta description. |
| 26 |
* |
| 27 |
* @var bool |
| 28 |
*/ |
| 29 |
private $has_description; |
| 30 |
|
| 31 |
/** |
| 32 |
* Constructs the content item data. |
| 33 |
* |
| 34 |
* @param int $content_id The content item ID. |
| 35 |
* @param string $title The content item title. |
| 36 |
* @param bool $has_description Whether the content item has a custom meta description. |
| 37 |
*/ |
| 38 |
public function __construct( int $content_id, string $title, bool $has_description ) { |
| 39 |
$this->content_id = $content_id; |
| 40 |
$this->title = $title; |
| 41 |
$this->has_description = $has_description; |
| 42 |
} |
| 43 |
|
| 44 |
/** |
| 45 |
* Returns the content item ID. |
| 46 |
* |
| 47 |
* @return int |
| 48 |
*/ |
| 49 |
public function get_content_id(): int { |
| 50 |
return $this->content_id; |
| 51 |
} |
| 52 |
|
| 53 |
/** |
| 54 |
* Returns the content item title. |
| 55 |
* |
| 56 |
* @return string |
| 57 |
*/ |
| 58 |
public function get_title(): string { |
| 59 |
return $this->title; |
| 60 |
} |
| 61 |
|
| 62 |
/** |
| 63 |
* Returns whether the content item has a custom meta description. |
| 64 |
* |
| 65 |
* @return bool |
| 66 |
*/ |
| 67 |
public function has_description(): bool { |
| 68 |
return $this->has_description; |
| 69 |
} |
| 70 |
} |
| 71 |
|