| 1 |
<?php |
| 2 |
|
| 3 |
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong |
| 4 |
namespace Yoast\WP\SEO\Editors\Domain\Seo; |
| 5 |
|
| 6 |
/** |
| 7 |
* This class describes the social SEO data. |
| 8 |
*/ |
| 9 |
class Social implements Seo_Plugin_Data_Interface { |
| 10 |
|
| 11 |
/** |
| 12 |
* The Social title template. |
| 13 |
* |
| 14 |
* @var string |
| 15 |
*/ |
| 16 |
private $social_title_template; |
| 17 |
|
| 18 |
/** |
| 19 |
* The Social description template. |
| 20 |
* |
| 21 |
* @var string |
| 22 |
*/ |
| 23 |
private $social_description_template; |
| 24 |
|
| 25 |
/** |
| 26 |
* The Social image template. |
| 27 |
* |
| 28 |
* @var string |
| 29 |
*/ |
| 30 |
private $social_image_template; |
| 31 |
|
| 32 |
/** |
| 33 |
* The first content image for the social preview. |
| 34 |
* |
| 35 |
* @var string |
| 36 |
*/ |
| 37 |
private $social_first_content_image; |
| 38 |
|
| 39 |
/** |
| 40 |
* The constructor. |
| 41 |
* |
| 42 |
* @param string $social_title_template The Social title template. |
| 43 |
* @param string $social_description_template The Social description template. |
| 44 |
* @param string $social_image_template The Social image template. |
| 45 |
* @param string $social_first_content_image The first content image for the social preview. |
| 46 |
*/ |
| 47 |
public function __construct( |
| 48 |
string $social_title_template, |
| 49 |
string $social_description_template, |
| 50 |
string $social_image_template, |
| 51 |
string $social_first_content_image |
| 52 |
) { |
| 53 |
$this->social_title_template = $social_title_template; |
| 54 |
$this->social_description_template = $social_description_template; |
| 55 |
$this->social_image_template = $social_image_template; |
| 56 |
$this->social_first_content_image = $social_first_content_image; |
| 57 |
} |
| 58 |
|
| 59 |
/** |
| 60 |
* Returns the data as an array format. |
| 61 |
* |
| 62 |
* @return array<string> |
| 63 |
*/ |
| 64 |
public function to_array(): array { |
| 65 |
return [ |
| 66 |
'social_title_template' => $this->social_title_template, |
| 67 |
'social_description_template' => $this->social_description_template, |
| 68 |
'social_image_template' => $this->social_image_template, |
| 69 |
'first_content_image_social_preview' => $this->social_first_content_image, |
| 70 |
]; |
| 71 |
} |
| 72 |
|
| 73 |
/** |
| 74 |
* Returns the data as an array format meant for legacy use. |
| 75 |
* |
| 76 |
* @return array<string> |
| 77 |
*/ |
| 78 |
public function to_legacy_array(): array { |
| 79 |
return [ |
| 80 |
'social_title_template' => $this->social_title_template, |
| 81 |
'social_description_template' => $this->social_description_template, |
| 82 |
'social_image_template' => $this->social_image_template, |
| 83 |
'first_content_image' => $this->social_first_content_image, |
| 84 |
]; |
| 85 |
} |
| 86 |
} |
| 87 |
|