Code Duplication    Length = 18-18 lines in 2 locations

Channel/Channel.php 2 locations

@@ 80-97 (lines=18) @@
77
        return $message;
78
    }
79
80
    public function format(NotificationInterface $notification)
81
    {
82
        try {
83
            // Do the formatting.
84
            $message = $this->adapter->format($notification);
85
86
            if (!empty($this->eventDispatcher)) {
87
                $messageEvent = new MessageCreatedEvent($message);
88
                $this->eventDispatcher->dispatch(MessageCreatedEvent::NAME, $messageEvent);
89
            }
90
91
            return $message;
92
        } catch (\Exception $e) {
93
            throw new MessageFormatException(
94
                $e->getMessage() . ' ' . $e->getCode() . ' ' . $e->getFile() . ' ' . $e->getLine()
95
            );
96
        }
97
    }
98
99
    public function dispatch(MessageInterface $message)
100
    {
@@ 99-116 (lines=18) @@
96
        }
97
    }
98
99
    public function dispatch(MessageInterface $message)
100
    {
101
        // Dispatch the message
102
        try {
103
            $sent = $this->adapter->dispatch($message);
104
105
            if ($sent && !empty($this->eventDispatcher)) {
106
                $messageEvent = new MessageDispatchedEvent($message);
107
                $this->eventDispatcher->dispatch(MessageDispatchedEvent::NAME, $messageEvent);
108
            }
109
110
            return $sent;
111
        } catch (\Exception $e) {
112
            throw new MessageDispatchException(
113
                $e->getMessage() . ' ' . $e->getCode() . ' ' . $e->getFile() . ' ' . $e->getLine()
114
            );
115
        }
116
    }
117
}
118