Completed
Push — master ( 4370c7...e76084 )
by Thomas
22s queued 10s
created

EventHandlers   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 70
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
eloc 1
c 1
b 0
f 0
dl 0
loc 70
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A preUpdate() 0 2 1
A onInit() 0 2 1
A onChange() 0 2 1
A postUpdate() 0 2 1
A postPersist() 0 2 1
A prePersist() 0 2 1
1
<?php
2
3
namespace ORM\Entity;
4
5
trait EventHandlers
6
{
7
    /**
8
     * Empty event handler
9
     *
10
     * Get called when the entity get initialized.
11
     *
12
     * @param bool $new Whether or not the entity is new or from database
13
     * @codeCoverageIgnore dummy event handler
14
     */
15
    public function onInit($new)
0 ignored issues
show
Unused Code introduced by
The parameter $new is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

15
    public function onInit(/** @scrutinizer ignore-unused */ $new)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
16
    {
17
    }
18
19
    /**
20
     * Empty event handler
21
     *
22
     * Get called when something is changed with magic setter.
23
     *
24
     * @param string $attribute The variable that got changed.merge(node.inheritedProperties)
25
     * @param mixed  $oldValue  The old value of the variable
26
     * @param mixed  $value     The new value of the variable
27
     * @codeCoverageIgnore dummy event handler
28
     */
29
    public function onChange($attribute, $oldValue, $value)
0 ignored issues
show
Unused Code introduced by
The parameter $value is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

29
    public function onChange($attribute, $oldValue, /** @scrutinizer ignore-unused */ $value)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $oldValue is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

29
    public function onChange($attribute, /** @scrutinizer ignore-unused */ $oldValue, $value)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $attribute is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

29
    public function onChange(/** @scrutinizer ignore-unused */ $attribute, $oldValue, $value)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
30
    {
31
    }
32
33
    /**
34
     * Empty event handler
35
     *
36
     * Get called before the entity get inserted in database.
37
     *
38
     * @codeCoverageIgnore dummy event handler
39
     */
40
    public function prePersist()
41
    {
42
    }
43
44
    /**
45
     * Empty event handler
46
     *
47
     * Get called before the entity get updated in database.
48
     *
49
     * @codeCoverageIgnore dummy event handler
50
     */
51
    public function preUpdate()
52
    {
53
    }
54
55
    /**
56
     * Empty event handler
57
     *
58
     * Get called after the entity got inserted in database.
59
     *
60
     * @codeCoverageIgnore dummy event handler
61
     */
62
    public function postPersist()
63
    {
64
    }
65
66
    /**
67
     * Empty event handler
68
     *
69
     * Get called after the entity got updated in database.
70
     *
71
     * @codeCoverageIgnore dummy event handler
72
     */
73
    public function postUpdate()
74
    {
75
    }
76
}
77