Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 10
CRAP
0.00% covered (danger)
0.00%
0 / 36
ChatMessage
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 10
240
0.00% covered (danger)
0.00%
0 / 36
 __construct
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 4
 fromNotification
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 5
 subject
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 4
 getSubject
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 3
 getRecipientId
0.00% covered (danger)
0.00%
0 / 1
12
0.00% covered (danger)
0.00%
0 / 3
 options
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 4
 getOptions
0.00% covered (danger)
0.00%
0 / 1
6
0.00% covered (danger)
0.00%
0 / 3
 transport
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 4
 getTransport
0.00% covered (danger)
0.00%
0 / 1
6
0.00% covered (danger)
0.00%
0 / 3
 getNotification
0.00% covered (danger)
0.00%
0 / 1
6
0.00% covered (danger)
0.00%
0 / 3
<?php
/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace Symfony\Component\Notifier\Message;
use Symfony\Component\Notifier\Notification\Notification;
use Symfony\Component\Notifier\Recipient\Recipient;
/**
 * @author Fabien Potencier <fabien@symfony.com>
 *
 * @experimental in 5.0
 */
final class ChatMessage implements MessageInterface
{
    private $transport;
    private $subject;
    private $options;
    private $notification;
    public function __construct(string $subject, MessageOptionsInterface $options = null)
    {
        $this->subject = $subject;
        $this->options = $options;
    }
    public static function fromNotification(Notification $notification, Recipient $recipient, string $transport = null): self
    {
        $message = new self($notification->getSubject());
        $message->notification = $notification;
        return $message;
    }
    /**
     * @return $this
     */
    public function subject(string $subject): self
    {
        $this->subject = $subject;
        return $this;
    }
    public function getSubject(): string
    {
        return $this->subject;
    }
    public function getRecipientId(): ?string
    {
        return $this->options ? $this->options->getRecipientId() : null;
    }
    /**
     * @return $this
     */
    public function options(MessageOptionsInterface $options): self
    {
        $this->options = $options;
        return $this;
    }
    public function getOptions(): ?MessageOptionsInterface
    {
        return $this->options;
    }
    /**
     * @return $this
     */
    public function transport(string $transport): self
    {
        $this->transport = $transport;
        return $this;
    }
    public function getTransport(): ?string
    {
        return $this->transport;
    }
    public function getNotification(): ?Notification
    {
        return $this->notification;
    }
}