PHP Class ValueObjects\Person\Name

Inheritance: implements ValueObjects\ValueObjectInterface
Show file Open project: nicolopignatelli/valueobjects Class Usage Examples

Public Methods

Method Description
__construct ( ValueObjects\StringLiteral\StringLiteral $first_name, ValueObjects\StringLiteral\StringLiteral $middle_name, ValueObjects\StringLiteral\StringLiteral $last_name ) Returns a Name object
__toString ( ) : string Returns the full name
fromNative ( ) : Name Returns a Name objects form PHP native values
getFirstName ( ) : ValueObjects\StringLiteral\StringLiteral Returns the first name
getFullName ( ) : ValueObjects\StringLiteral\StringLiteral Returns the full name
getLastName ( ) : ValueObjects\StringLiteral\StringLiteral Returns the last name
getMiddleName ( ) : ValueObjects\StringLiteral\StringLiteral Returns the middle name
sameValueAs ( ValueObjects\ValueObjectInterface $name ) : boolean Tells whether two names are equal by comparing their values

Method Details

__construct() public method

Returns a Name object
public __construct ( ValueObjects\StringLiteral\StringLiteral $first_name, ValueObjects\StringLiteral\StringLiteral $middle_name, ValueObjects\StringLiteral\StringLiteral $last_name )
$first_name ValueObjects\StringLiteral\StringLiteral
$middle_name ValueObjects\StringLiteral\StringLiteral
$last_name ValueObjects\StringLiteral\StringLiteral

__toString() public method

Returns the full name
public __toString ( ) : string
return string

fromNative() public static method

Returns a Name objects form PHP native values
public static fromNative ( ) : Name
return Name

getFirstName() public method

Returns the first name
public getFirstName ( ) : ValueObjects\StringLiteral\StringLiteral
return ValueObjects\StringLiteral\StringLiteral

getFullName() public method

Returns the full name
public getFullName ( ) : ValueObjects\StringLiteral\StringLiteral
return ValueObjects\StringLiteral\StringLiteral

getLastName() public method

Returns the last name
public getLastName ( ) : ValueObjects\StringLiteral\StringLiteral
return ValueObjects\StringLiteral\StringLiteral

getMiddleName() public method

Returns the middle name
public getMiddleName ( ) : ValueObjects\StringLiteral\StringLiteral
return ValueObjects\StringLiteral\StringLiteral

sameValueAs() public method

Tells whether two names are equal by comparing their values
public sameValueAs ( ValueObjects\ValueObjectInterface $name ) : boolean
$name ValueObjects\ValueObjectInterface
return boolean