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
← All changes | src/generators/twitter-image-generator.php +13 -9 18.428.5 View file →
@@ -6,9 +6,9 @@
6 6 use Yoast\WP\SEO\Helpers\Image_Helper;
7 7 use Yoast\WP\SEO\Helpers\Twitter\Image_Helper as Twitter_Image_Helper;
8 8 use Yoast\WP\SEO\Helpers\Url_Helper;
9 9 use Yoast\WP\SEO\Models\Indexable;
10 -use Yoast\WP\SEO\Values\Images;
10 +use Yoast\WP\SEO\Values\Twitter\Images;
11 11
12 12 /**
13 13 * Represents the generator class for the Twitter images.
14 14 */
@@ -14,8 +14,15 @@
14 14 */
15 15 class Twitter_Image_Generator implements Generator_Interface {
16 16
17 17 /**
18 + * The Twitter image helper.
19 + *
20 + * @var Twitter_Image_Helper
21 + */
22 + protected $twitter_image;
23 +
24 + /**
18 25 * The image helper.
19 26 *
20 27 * @var Image_Helper
21 28 */
@@ -28,15 +35,8 @@
28 35 */
29 36 protected $url;
30 37
31 38 /**
32 - * The Twitter image helper.
33 - *
34 - * @var Twitter_Image_Helper
35 - */
36 - protected $twitter_image;
37 -
38 - /**
39 39 * Twitter_Image_Generator constructor.
40 40 *
41 41 * @codeCoverageIgnore
42 42 *
@@ -54,9 +54,9 @@
54 54 * Retrieves the images for an indexable.
55 55 *
56 56 * @param Meta_Tags_Context $context The context.
57 57 *
58 - * @return array The images.
58 + * @return array<array<string, string|int>> The images.
59 59 */
60 60 public function generate( Meta_Tags_Context $context ) {
61 61 $image_container = $this->get_image_container();
62 62
@@ -69,8 +69,10 @@
69 69 * Adds an image based on the given indexable.
70 70 *
71 71 * @param Indexable $indexable The indexable.
72 72 * @param Images $image_container The image container.
73 + *
74 + * @return void
73 75 */
74 76 protected function add_from_indexable( Indexable $indexable, Images $image_container ) {
75 77 if ( $indexable->twitter_image_id ) {
76 78 $image_container->add_image_by_id( $indexable->twitter_image_id );
@@ -91,8 +93,10 @@
91 93 */
92 94 protected function get_image_container() {
93 95 $image_container = new Images( $this->image, $this->url );
94 96 $image_container->image_size = $this->twitter_image->get_image_size();
97 +
98 + $image_container->set_helpers( $this->twitter_image );
95 99
96 100 return $image_container;
97 101 }
98 102 }