Passed
Push — main ( b8a21f...30ae18 )
by Michael
01:04 queued 13s
created

FullNameFormatter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 5
c 1
b 0
f 1
dl 0
loc 21
ccs 6
cts 6
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A format() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MichaelRubel\Formatters\Collection;
6
7
use MichaelRubel\Formatters\Formatter;
8
9
class FullNameFormatter implements Formatter
10
{
11
    /**
12
     * @param  string|null  $name
13
     */
14 10
    public function __construct(public ?string $name)
15
    {
16
        //
17
    }
18
19
    /**
20
     * Format the full name.
21
     *
22
     * @return string
23
     */
24 10
    public function format(): string
25
    {
26 10
        return str($this->name)
27 10
            ->squish()
28 10
            ->headline()
29 10
            ->value();
30
    }
31
}
32