ProvidesLifeCycleNotifier   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 30
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setLifeCycleNotifier() 0 5 1
A getLifeCycleNotifier() 0 6 2
1
<?php
2
3
/**
4
 * This file is part of cloak.
5
 *
6
 * (c) Noritaka Horio <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace cloak;
13
14
/**
15
 * Trait ProvidesLifeCycleNotifier
16
 * @package cloak
17
 */
18
trait ProvidesLifeCycleNotifier
19
{
20
21
    /**
22
     * @var \cloak\LifeCycleNotifier
23
     */
24
    protected $notifier;
25
26
27
    /**
28
     * @param \cloak\LifeCycleNotifier $notifier
29
     * @return $this
30
     */
31
    public function setLifeCycleNotifier(LifeCycleNotifier $notifier)
32
    {
33
        $this->notifier = $notifier;
34
        return $this;
35
    }
36
37
    /**
38
     * @return \cloak\LifeCycleNotifier
39
     */
40
    public function getLifeCycleNotifier()
41
    {
42
        $this->notifier = $this->notifier ?: new AnalyzeLifeCycleNotifier();
43
44
        return $this->notifier;
45
    }
46
47
}
48