1
<?php
2

3
declare(strict_types=1);
4

5
/**
6
 * Copyright (c) 2017-2020 Andreas Möller
7
 *
8
 * For the full copyright and license information, please view
9
 * the LICENSE.md file that was distributed with this source code.
10
 *
11
 * @see https://github.com/ergebnis/php-library-template
12
 */
13

14
namespace Ergebnis\Library;
15

16
final class Example
17
{
18
    private $name;
19

20 1
    private function __construct(string $name)
21
    {
22 1
        $this->name = $name;
23
    }
24

25 1
    public static function fromName(string $name): self
26
    {
27 1
        return new self($name);
28
    }
29

30 1
    public function name(): string
31
    {
32 1
        return $this->name;
33
    }
34
}

Read our documentation on viewing source code .

Loading