LaundromatServiceProvider::registerCommands()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
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