ValueObjects\Web\EmailAddress::getLocalPart PHP Méthode

getLocalPart() public méthode

Returns the local part of the email address
public getLocalPart ( ) : ValueObjects\StringLiteral\StringLiteral
Résultat ValueObjects\StringLiteral\StringLiteral
    public function getLocalPart()
    {
        $parts = explode('@', $this->toNative());
        $localPart = new StringLiteral($parts[0]);
        return $localPart;
    }

Usage Example

 public function testGetLocalPart()
 {
     $email = new EmailAddress('*****@*****.**');
     $localPart = $email->getLocalPart();
     $this->assertEquals('foo', $localPart->toNative());
 }