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());
 }