Passed
Push — main ( 10ea54...ae133a )
by Michael
03:26
created

HelpsFormatData   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A extractStringFromCollection() 0 7 2
1
<?php
2
3
namespace MichaelRubel\Formatters\Traits;
4
5
use Illuminate\Support\Collection;
6
7
trait HelpsFormatData
8
{
9
    /**
10
     * @param Collection $collection
11
     *
12
     * @return string
13
     */
14 6
    private function extractStringFromCollection(Collection $collection): string
15
    {
16 6
        $extracted = $collection->first();
17
18 6
        return is_string($extracted)
19 6
            ? $extracted
20 6
            : '';
21
    }
22
}
23