Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Author.php

class Author

Same name in this branch
  1. 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().

... See full list

File

vendor/phar-io/manifest/src/values/Author.php, line 15

Namespace

PharIo\Manifest
View 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-&gt;email
Author::__construct public function

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal