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

Component   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 31
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A bootIfNotBooted() 0 12 2
A boot() 0 3 1
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