Completed
Push — master ( 07981c...e259b1 )
by wen
25:43
created

Component::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
4
namespace Sco\Admin\Component;
5
6
7
use Sco\Admin\Component\Concerns\HasEvents;
8
use Sco\Admin\Contracts\ComponentInterface;
9
10
abstract class Component implements ComponentInterface
11
{
12
    use HasEvents;
13
14
    protected static $dispatcher;
15
16
    protected static $booted = [];
17
18
    public function __construct()
19
    {
20
        $this->bootIfNotBooted();
21
22
    }
23
24
    protected function bootIfNotBooted()
25
    {
26
        if (!isset(static::$booted[static::class])) {
27
            static::$booted[static::class] = true;
28
29
            $this->fireEvent('booting', false);
30
31
            static::boot();
32
33
            $this->fireEvent('booted', false);
34
        }
35
    }
36
37
    protected static function boot()
38
    {
39
    }
40
}
41