PHP 8.3.31
Preview: Author.php Size: 1.27 KB
/home/getspomw/royalsquad.us/vendor/phar-io/manifest/src/values/Author.php

<?php declare(strict_types = 1);
/*
 * This file is part of PharIo\Manifest.
 *
 * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 */
namespace PharIo\Manifest;

use function sprintf;

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;
    }
}

Directory Contents

Dirs: 0 × Files: 22

Name Size Perms Modified Actions
504 B lrw-rw-rw- 2025-09-17 06:53:37
Edit Download
1.15 KB lrw-rw-rw- 2025-09-17 06:53:36
Edit Download
1.27 KB lrw-rw-rw- 2025-09-17 06:53:36
Edit Download
1.02 KB lrw-rw-rw- 2025-09-17 06:53:37
Edit Download
1.13 KB lrw-rw-rw- 2025-09-17 06:53:37
Edit Download
840 B lrw-rw-rw- 2025-09-17 06:53:36
Edit Download
1.16 KB lrw-rw-rw- 2025-09-17 06:53:36
Edit Download
1.25 KB lrw-rw-rw- 2025-09-17 06:53:37
Edit Download
860 B lrw-rw-rw- 2025-09-17 06:53:37
Edit Download
912 B lrw-rw-rw- 2025-09-17 06:53:37
Edit Download
8.38 KB lrw-r--r-- 2026-04-26 10:05:32
Edit Download
1.40 KB lrw-rw-rw- 2025-09-17 06:53:36
Edit Download
496 B lrw-rw-rw- 2025-09-17 06:53:37
Edit Download
764 B lrw-rw-rw- 2025-09-17 06:53:37
Edit Download
2.54 KB lrw-rw-rw- 2025-09-17 06:53:37
Edit Download
682 B lrw-rw-rw- 2025-09-17 06:53:37
Edit Download
804 B lrw-rw-rw- 2025-09-17 06:53:37
Edit Download
424 B lrw-rw-rw- 2025-09-17 06:53:37
Edit Download
1.09 KB lrw-rw-rw- 2025-09-17 06:53:37
Edit Download
1.19 KB lrw-rw-rw- 2025-09-17 06:53:37
Edit Download
1.16 KB lrw-rw-rw- 2025-09-17 06:53:37
Edit Download
939 B lrw-rw-rw- 2025-09-17 06:53:37
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).