EventArguments   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 24
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A createEmpty() 0 7 2
1
<?php
2
3
namespace As3\Modlr\Events;
4
5
/**
6
 * Contains the arguments for an event.
7
 * This is the root class and does not contain any event data.
8
 * All event arguments must extend this class and define their own state.
9
 *
10
 * @author Jacob Bare <[email protected]>
11
 */
12
class EventArguments
13
{
14
    /**
15
     * The globally empty event instance.
16
     * Used when no event arguments are passed to the dispatcher.
17
     *
18
     * @var self
19
     */
20
    private static $emptyInstance;
21
22
    /**
23
     * Creates an empty arguments instance.
24
     * Ensures only one empty instances exists for all possible event calls without arguments.
25
     *
26
     * @return  self
27
     */
28
    public static function createEmpty()
29
    {
30
        if (null === self::$emptyInstance) {
31
            self::$emptyInstance = new self;
32
        }
33
        return self::$emptyInstance;
34
    }
35
}
36