Passed
Push — master ( b0047a...2d305e )
by Mehmet
02:41
created

StrTrExtendServiceProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 11
c 1
b 0
f 0
dl 0
loc 27
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 20 1
1
<?php
2
3
namespace XLaravel;
4
5
use Illuminate\Support\ServiceProvider;
6
use Illuminate\Support\Str;
7
8
/**
9
 * Class StrTrExtendServiceProvider
10
 * @package XLaravel
11
 */
12
class StrTrExtendServiceProvider extends ServiceProvider
13
{
14
    /**
15
     * Register any application services.
16
     *
17
     * @return void
18
     */
19
    public function register()
20
    {
21
        Str::macro('trUpper', function (string $value): string {
22
            return tr_strtoupper($value);
23
        });
24
25
        Str::macro('trLower', function (string $value): string {
26
            return tr_strtolower($value);
27
        });
28
29
        Str::macro('trUcFirst', function (string $value): string {
30
            return tr_ucfirst($value);
31
        });
32
33
        Str::macro('trLcFirst', function (string $value): string {
34
            return tr_lcfirst($value);
35
        });
36
37
        Str::macro('trUcWords', function (string $value): string {
38
            return tr_ucwords($value);
39
        });
40
    }
41
}
42