Passed
Push — master ( 266d2c...9f91a2 )
by Caen
11:14 queued 08:29
created

ImplementsStringHelpers::makeTitle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 8
rs 10
1
<?php
2
3
namespace Hyde\Framework\Foundation\Concerns;
4
5
use Illuminate\Support\Str;
6
7
/**
8
 * @internal Single-use trait for the HydeKernel class.
9
 *
10
 * @see \Hyde\Framework\HydeKernel
11
 */
12
trait ImplementsStringHelpers
13
{
14
    public function makeTitle(string $slug): string
15
    {
16
        $alwaysLowercase = ['a', 'an', 'the', 'in', 'on', 'by', 'with', 'of', 'and', 'or', 'but'];
17
18
        return ucfirst(str_ireplace(
0 ignored issues
show
Bug introduced by
It seems like str_ireplace($alwaysLowe...t\Str::headline($slug)) can also be of type array; however, parameter $string of ucfirst() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

18
        return ucfirst(/** @scrutinizer ignore-type */ str_ireplace(
Loading history...
19
            $alwaysLowercase,
20
            $alwaysLowercase,
21
            Str::headline($slug)
22
        ));
23
    }
24
}
25