19declare(strict_types=1);
38 private readonly
string $skin_directory,
43 $this->locations = $skin ===
'default' ? [] : [$skin, $skin .
'/' . $style];
48 foreach (array_reverse($this->locations) as
$location) {
51 if (is_file($path) && is_readable($path)) {
56 return $this->fallback->styleSheet();
66 if (is_dir($directory) && is_readable($directory)) {
67 $images = $images->with(...$this->
imagesIn($directory));
71 if ($images->isEmpty()) {
72 return $this->fallback->inlineImages();
75 return $this->logo->markIn($images);
81 private function imagesIn(
string $directory): array
84 $files = new \RegexIterator(
85 new \FilesystemIterator(
87 \FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS
92 foreach (
$files as $path) {
93 if (is_file($path) && is_readable($path)) {
A readable file an HTML mail is built from.
Designates one of a set of images as the mail's logo by file name convention, falling back to the fir...
Prefers the mail assets of a Customizing skin and falls back to the assets it decorates.
readonly array $locations
const string LOGO_DIRECTORY
const string IMAGE_PATTERN
imagesIn(string $directory)
__construct(private readonly MailAssets $fallback, private readonly string $skin_directory, private readonly LogoByFileName $logo, string $skin, string $style)