LaraTransliterationServiceProvider   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 22
ccs 0
cts 9
cp 0
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 12 1
1
<?php
2
3
namespace Zvermafia\LaraTransliteration;
4
5
use GuzzleHttp\Client;
6
use Zvermafia\Transliteration\Transliterator;
7
use Zvermafia\Transliteration\Contracts\TransliteratorContract;
8
use Illuminate\Support\ServiceProvider;
9
10
class LaraTransliterationServiceProvider extends ServiceProvider
11
{
12
    /** @var string */
13
    const SERVICE_NAME = 'zvermafia.laratransliterator';
14
15
    /**
16
     * Register the application services.
17
     *
18
     * @return void
19
     */
20
    public function register()
21
    {
22
        // Prepare the HTTP client
23
        $client = new Client([
24
            'base_uri' => Transliterator::API_BASE_URI,
25
        ]);
26
27
        $this->app->singleton(self::SERVICE_NAME, function ($app) use ($client) {
0 ignored issues
show
Unused Code introduced by
The parameter $app is not used and could be removed. ( Ignorable by Annotation )

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

27
        $this->app->singleton(self::SERVICE_NAME, function (/** @scrutinizer ignore-unused */ $app) use ($client) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
28
            return new Transliterator($client);
29
        });
30
31
        $this->app->alias(self::SERVICE_NAME, TransliteratorContract::class);
32
    }
33
}
34