Code Duplication    Length = 15-15 lines in 2 locations

src/Event/BaseEventEmitterTrait.php 2 locations

@@ 63-77 (lines=15) @@
60
    /**
61
     * @see EventEmitterInterface::on
62
     */
63
    public function on($event, callable $listener)
64
    {
65
        if (!isset($this->eventListeners[$event]))
66
        {
67
            $this->eventPointers[$event] = 0;
68
            $this->eventListeners[$event] = [];
69
        }
70
71
        $pointer = &$this->eventPointers[$event];
72
        $eventListener = new EventListener($this, $event, $listener, $this->attachOnListener($pointer, $event, $listener));
73
74
        $this->eventListeners[$event][$pointer++] = $eventListener;
75
76
        return $eventListener;
77
    }
78
79
    /**
80
     * @see EventEmitterInterface::once
@@ 82-96 (lines=15) @@
79
    /**
80
     * @see EventEmitterInterface::once
81
     */
82
    public function once($event, callable $listener)
83
    {
84
        if (!isset($this->eventListeners[$event]))
85
        {
86
            $this->eventPointers[$event] = 0;
87
            $this->eventListeners[$event] = [];
88
        }
89
90
        $pointer = &$this->eventPointers[$event];
91
        $eventListener = new EventListener($this, $event, $listener, $this->attachOnceListener($pointer, $event, $listener));
92
93
        $this->eventListeners[$event][$pointer++] = $eventListener;
94
95
        return $eventListener;
96
    }
97
98
    /**
99
     * @see EventEmitterInterface::times