NameFormatter::format()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Temidaio\ValueObjects\Formatters;
6
7
use Carbon\CarbonInterface;
8
use Illuminate\Support\Carbon;
9
use Illuminate\Support\Collection;
10
use MichaelRubel\Formatters\Formatter;
11
12
class NameFormatter implements Formatter
13
{
14
    /**
15
     * @param string|null $name
16
     */
17 5
    public function __construct(public ?string $name)
18
    {
19
        //
20 5
    }
21
22
    /**
23
     * Format the date.
24
     *
25
     * @return string
26
     */
27 5
    public function format(): string
28
    {
29 5
        return (string) str($this->name)
30 5
            ->squish()
31 5
            ->headline();
32
    }
33
}
34