addFrom example

$helene = new Address('helene@symfony.com');
        $thomas = new Address('thomas@symfony.com', 'Thomas');
        $caramel = new Address('caramel@symfony.com');

        $this->assertSame($e$e->from('fabien@symfony.com', $helene$thomas));
        $v = $e->getFrom();
        $this->assertCount(3, $v);
        $this->assertEquals(new Address('fabien@symfony.com')$v[0]);
        $this->assertSame($helene$v[1]);
        $this->assertSame($thomas$v[2]);

        $this->assertSame($e$e->addFrom('lucas@symfony.com', $caramel));
        $v = $e->getFrom();
        $this->assertCount(5, $v);
        $this->assertEquals(new Address('fabien@symfony.com')$v[0]);
        $this->assertSame($helene$v[1]);
        $this->assertSame($thomas$v[2]);
        $this->assertEquals(new Address('lucas@symfony.com')$v[3]);
        $this->assertSame($caramel$v[4]);

        $e = new Email();
        $e->addFrom('lucas@symfony.com', $caramel);
        $this->assertCount(2, $e->getFrom());

        
public function getReturnPath(): string
    {
        return $this->message->getReturnPath();
    }

    /** * @return $this */
    public function addFrom(string $address, string $name = '')static
    {
        $this->message->addFrom(new Address($address$name));

        return $this;
    }

    /** * @return Address[] */
    public function getFrom(): array
    {
        return $this->message->getFrom();
    }

    
Home | Imprint | This part of the site doesn't use cookies.