Booter::boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
1
<?php namespace Mascame\Artificer\Extension;
2
3
use Illuminate\Support\Str;
4
use Mascame\Extender\Booter\BooterInterface;
5
6
class Booter extends \Mascame\Extender\Booter\Booter implements BooterInterface {
7
8
    /**
9
     * @var \Mascame\Artificer\Extension\PluginManager
10
     */
11
    protected $manager;
12
13
    public function boot($instance, $name)
14
    {
15
        $this->beforeBooting($instance, $name);
16
17
        return parent::boot($instance, $name);
18
    }
19
20
    /**
21
     * @param $instance
22
     * @param $name
23
     */
24
    public function beforeBooting($instance, $name) {
25
        if (! $instance->namespace) $instance->namespace = $name;
26
        if (! $instance->slug) $instance->slug = Str::slug($name);
27
28
        $this->manager->setSlug($instance->slug, $instance->namespace);
29
    }
30
}
31