Concrete implementation of the ComposerJsonAuthorInterface.
Description
This class represents an author entry within a composer.json file and provides structured access to author metadata such as name, email, homepage, and role.
Implementations of this class MUST ensure that all provided data is consistent and valid according to Composer expectations. Consumers of this class MAY rely on its immutability if used in a readonly context.
The string representation of this class SHALL return a human-readable representation of the author.
Interfaces
Properties
Methods
Constructs a new ComposerJsonAuthor instance.
Returns a string representation of the author.
Retrieves the email address of the author.
Retrieves the homepage URL of the author.
Retrieves the name of the author.
Retrieves the role of the author.
Constructs a new ComposerJsonAuthor instance.
public
__construct([
string
$name = ''][,
string
$email = ''][,
string
$homepage = ''][,
string
$role = '']) : mixed
Description
All parameters MUST be provided as strings. Implementations SHOULD validate the correctness of email and URL formats before assignment if strict validation is required.
Parameters
$name
:
string
=
''
Description
the name of the author
$email
:
string
=
''
Description
the email address of the author
$homepage
:
string
=
''
Description
the homepage URL of the author
$role
:
string
=
''
Description
the role of the author
Returns a string representation of the author.
public
__toString() : string
Description
This method SHALL return a formatted string combining the author's name and email. Implementations MAY extend this format but SHOULD maintain readability.
Return values
Description
the string representation of the author
Retrieves the email address of the author.
public
getEmail() : string
Return values
Description
the email address of the author
Retrieves the homepage URL of the author.
public
getHomepage() : string
Return values
Description
the homepage URL of the author
Retrieves the name of the author.
public
getName() : string
Return values
Description
the full name of the author
Retrieves the role of the author.
public
getRole() : string
Return values
Description
the role of the author