Code Duplication    Length = 9-9 lines in 2 locations

Event/EventBus.php 1 location

@@ 49-57 (lines=9) @@
46
     */
47
    public function dispatch(MessageInterface $event)
48
    {
49
        if (!$event instanceof EventInterface) {
50
            throw new \InvalidArgumentException(
51
                sprintf(
52
                    'The object must be an instance of %s. Instance of %s given',
53
                    EventInterface::class,
54
                    get_class($event)
55
                )
56
            );
57
        }
58
59
        $this->ensureEventDispatcherMiddleware();
60

Middlewares/EventDispatcher/EventDispatcherMiddleware.php 1 location

@@ 45-53 (lines=9) @@
42
     */
43
    public function handle($event, callable $next)
44
    {
45
        if (!$event instanceof EventInterface) {
46
            throw new \InvalidArgumentException(
47
                sprintf(
48
                    'The object must be an instance of %s. Instance of %s given',
49
                    EventInterface::class,
50
                    get_class($event)
51
                )
52
            );
53
        }
54
55
        $this->dispatcher->dispatch($event);
56