ValueObjects\Web\EmailAddress::getLocalPart PHP Метод

getLocalPart() публичный Метод

Returns the local part of the email address
public getLocalPart ( ) : ValueObjects\StringLiteral\StringLiteral
Результат ValueObjects\StringLiteral\StringLiteral
    public function getLocalPart()
    {
        $parts = explode('@', $this->toNative());
        $localPart = new StringLiteral($parts[0]);
        return $localPart;
    }

Usage Example

Пример #1
0
 public function testGetLocalPart()
 {
     $email = new EmailAddress('*****@*****.**');
     $localPart = $email->getLocalPart();
     $this->assertEquals('foo', $localPart->toNative());
 }