Source path: app/Services/Publishers/PublisherFactory.php
Extracted from supplied specification. Review before copying into application.

<?php
namespace App\Services\Publishers;

class PublisherFactory
{
    public function for(string $platform): Publisher
    {
        return match ($platform) {
            'facebook'  => app(FacebookPublisher::class),
            'instagram' => app(InstagramPublisher::class),
            default     => throw new \InvalidArgumentException("No publisher for {$platform}"),
        };
    }
}
