Passed
Branch master (8cb5b2)
by Christopher
04:33 queued 12s
created

ServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 22
dl 0
loc 60
ccs 16
cts 16
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 21 1
A register() 0 5 1
1
<?php
0 ignored issues
show
Coding Style introduced by
The PHP open tag does not have a corresponding PHP close tag
Loading history...
2
namespace Triadev\Leopard\Provider;
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
4
use Illuminate\Foundation\AliasLoader;
5
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
6
use Triadev\Leopard\Business\Repository\ElasticsearchRepository;
7
use Triadev\Leopard\Business\Repository\MappingLogRepository;
8
use Triadev\Leopard\Console\Commands\Index\Sync;
9
use Triadev\Leopard\Console\Commands\Mapping\Make;
10
use Triadev\Leopard\Console\Commands\Mapping\Migrate;
11
use Triadev\Leopard\Console\Commands\Mapping\Rollback;
12
use Triadev\Leopard\Contract\ElasticsearchManagerContract;
13
use Triadev\Leopard\Contract\Repository\ElasticsearchRepositoryContract;
14
use Triadev\Leopard\Contract\Repository\MappingLogRepositoryContract;
15
use Triadev\Leopard\ElasticsearchManager;
16
use Triadev\Leopard\Facade\Leopard;
17
use Triadev\Es\Provider\ElasticsearchServiceProvider;
18
19
class ServiceProvider extends BaseServiceProvider
0 ignored issues
show
Coding Style Documentation introduced by
Missing class doc comment
Loading history...
20
{
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration for class ServiceProvider
Loading history...
21
    /**
22
     * All of the container bindings that should be registered.
23
     *
24
     * @var array
25
     */
26
    public $bindings = [
1 ignored issue
show
Coding Style introduced by
Expected 1 blank line before member var; 0 found
Loading history...
27
        ElasticsearchRepositoryContract::class => ElasticsearchRepository::class,
0 ignored issues
show
Coding Style introduced by
This array key does not seem to be aligned correctly; expected 24 spaces, but found 8.
Loading history...
28
        MappingLogRepositoryContract::class => MappingLogRepository::class
0 ignored issues
show
Coding Style introduced by
This array key does not seem to be aligned correctly; expected 24 spaces, but found 8.
Loading history...
29
    ];
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 23 space(s), but found 4.
Loading history...
30
    
31
    /**
32
     * All of the container singletons that should be registered.
33
     *
34
     * @var array
35
     */
36
    public $singletons = [
37
        ElasticsearchManagerContract::class => ElasticsearchManager::class,
0 ignored issues
show
Coding Style introduced by
This array key does not seem to be aligned correctly; expected 26 spaces, but found 8.
Loading history...
38
    ];
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 25 space(s), but found 4.
Loading history...
39
    
40
    /**
41
     * Bootstrap the application events.
42
     *
43
     * @return void
44
     */
45 132
    public function boot()
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 1 found
Loading history...
46
    {
47 132
        $source = realpath(__DIR__ . '/../Config/config.php');
0 ignored issues
show
Coding Style introduced by
Concat operator must not be surrounded by spaces
Loading history...
48
    
49 132
        $this->publishes([
1 ignored issue
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
50 132
            __DIR__ . '/../Config/config.php' => config_path('leopard.php'),
0 ignored issues
show
Coding Style introduced by
This array key does not seem to be aligned correctly; expected 26 spaces, but found 12.
Loading history...
Coding Style introduced by
Concat operator must not be surrounded by spaces
Loading history...
51 132
        ], 'config');
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 25 space(s), but found 8.
Loading history...
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
52
    
53 132
        $this->mergeConfigFrom($source, 'leopard');
54
    
55 132
        $this->loadMigrationsFrom(__DIR__ . '/../Resources/database/migrations');
0 ignored issues
show
Coding Style introduced by
Concat operator must not be surrounded by spaces
Loading history...
56
    
57 132
        $this->publishes([
1 ignored issue
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
58 132
            __DIR__.'/Resources/database' => database_path(),
0 ignored issues
show
Coding Style introduced by
This array key does not seem to be aligned correctly; expected 26 spaces, but found 12.
Loading history...
59 132
        ], 'database');
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 25 space(s), but found 8.
Loading history...
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
60
        
61 132
        $this->commands([
1 ignored issue
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
62 132
            Make::class,
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 25 spaces, but found 12.
Loading history...
63
            Migrate::class,
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 25 spaces, but found 12.
Loading history...
64
            Rollback::class,
0 ignored issues
show
Coding Style introduced by
This array value does not seem to be aligned correcty; expected 25 spaces, but found 12.
Loading history...
65
            Sync::class
0 ignored issues
show
Coding Style introduced by
There should be a trailing comma after the last value of an array declaration.
Loading history...
66
        ]);
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 24 space(s), but found 8.
Loading history...
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
67 132
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end boot()
Loading history...
68
    
69
    /**
70
     * Register bindings in the container.
71
     *
72
     * @return void
73
     */
74 132
    public function register()
75
    {
76 132
        $this->app->register(ElasticsearchServiceProvider::class);
77
        
78 132
        AliasLoader::getInstance()->alias('Leopard', Leopard::class);
79 132
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end register()
Loading history...
80
}
0 ignored issues
show
Coding Style introduced by
Expected //end class
Loading history...
Coding Style introduced by
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
81