LaundromatServiceProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 28
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 10 1
A registerCommands() 0 8 1
1
<?php
2
3
namespace LaravelLaundromat;
4
5
use Illuminate\Support\Collection;
6
use Illuminate\Database\Eloquent\Model;
7
use Illuminate\Support\ServiceProvider;
8
9
class LaundromatServiceProvider extends ServiceProvider
10
{
11
    /**
12
     * Register bindings in the container.
13
     */
14
    public function register()
15
    {
16
        Collection::macro('clean', function ($class = null) {
17
            return $this->map(function (Model $item) use ($class) {
0 ignored issues
show
Bug introduced by
The method map() does not seem to exist on object<LaravelLaundromat...ndromatServiceProvider>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
18
                return $item->clean($class);
19
            });
20
        });
21
22
        $this->registerCommands();
23
    }
24
25
    /**
26
     * Register the package commands.
27
     */
28
    protected function registerCommands()
29
    {
30
        $this->app->singleton('command.laundromat.create', function ($app) {
31
            return $app['LaravelLaundromat\commands\CreateCleaner'];
32
        });
33
34
        $this->commands('command.laundromat.create');
35
    }
36
}
37