AbstractChannel.php 1019 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Notifier\Channel;
  11. use Symfony\Component\Messenger\MessageBusInterface;
  12. use Symfony\Component\Notifier\Exception\LogicException;
  13. use Symfony\Component\Notifier\Transport\TransportInterface;
  14. /**
  15. * @author Fabien Potencier <fabien@symfony.com>
  16. *
  17. * @experimental in 5.1
  18. */
  19. abstract class AbstractChannel implements ChannelInterface
  20. {
  21. protected $transport;
  22. protected $bus;
  23. public function __construct(TransportInterface $transport = null, MessageBusInterface $bus = null)
  24. {
  25. if (null === $transport && null === $bus) {
  26. throw new LogicException(sprintf('"%s" needs a Transport or a Bus but both cannot be "null".', static::class));
  27. }
  28. $this->transport = $transport;
  29. $this->bus = $bus;
  30. }
  31. }