class Author
Same name in this branch
- 11.1.x vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Author.php \phpDocumentor\Reflection\DocBlock\Tags\Author
Hierarchy
- class \PharIo\Manifest\Author
Expanded class hierarchy of Author
37 string references to 'Author'
- AuthorFormatter::viewElements in core/
modules/ user/ src/ Plugin/ Field/ FieldFormatter/ AuthorFormatter.php - Builds a renderable array for a field value.
- CommentAdminOverview::buildForm in core/
modules/ comment/ src/ Form/ CommentAdminOverview.php - Form constructor for the comment overview administration form.
- CommentHooks::entityExtraFieldInfo in core/
modules/ comment/ src/ Hook/ CommentHooks.php - Implements hook_entity_extra_field_info().
- CommentTokensHooks::tokenInfo in core/
modules/ comment/ src/ Hook/ CommentTokensHooks.php - Implements hook_token_info().
- CommentTokensHooks::tokens in core/
modules/ comment/ src/ Hook/ CommentTokensHooks.php - Implements hook_tokens().
File
-
vendor/
phar-io/ manifest/ src/ values/ Author.php, line 15
Namespace
PharIo\ManifestView source
class Author {
/** @var string */
private $name;
/** @var null|Email */
private $email;
public function __construct(string $name, ?Email $email = null) {
$this->name = $name;
$this->email = $email;
}
public function asString() : string {
if (!$this->hasEmail()) {
return $this->name;
}
return sprintf('%s <%s>', $this->name, $this->email
->asString());
}
public function getName() : string {
return $this->name;
}
/**
* @psalm-assert-if-true Email $this->email
*/
public function hasEmail() : bool {
return $this->email !== null;
}
public function getEmail() : Email {
if (!$this->hasEmail()) {
throw new NoEmailAddressException();
}
return $this->email;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
Author::$email | private | property | @var null|Email |
Author::$name | private | property | @var string |
Author::asString | public | function | |
Author::getEmail | public | function | |
Author::getName | public | function | |
Author::hasEmail | public | function | @psalm-assert-if-true Email $this->email |
Author::__construct | public | function |