vendor/codefog/contao-social_images/src/Routing/ResponseContext/SocialImagesBag.php line 15

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. /*
  4. * This file is part of SocialImagesBundle.
  5. *
  6. * (c) Codefog
  7. *
  8. * @license MIT
  9. */
  10. namespace Codefog\SocialImagesBundle\Routing\ResponseContext;
  11. class SocialImagesBag
  12. {
  13. private array $images = [];
  14. /**
  15. * Get all images.
  16. */
  17. public function all(): array
  18. {
  19. return $this->images;
  20. }
  21. /**
  22. * Add an image.
  23. */
  24. public function add(string $path, bool $prepend): void
  25. {
  26. if ($prepend) {
  27. array_unshift($this->images, $path);
  28. } else {
  29. $this->images[] = $path;
  30. }
  31. }
  32. }