| @@ -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 | } |