Code Duplication    Length = 15-18 lines in 3 locations

PHPDaemon/Clients/AMQP/Driver/Exception/AMQPConnectionException.php 3 locations

@@ 51-65 (lines=15) @@
48
     * @param \Exception|null $previous The exception that caused this exception, if any.
49
     * @return AMQPConnectionException
50
     */
51
    public static function notOpen(
52
        ConnectionOptions $options,
53
        \Exception $previous = null
54
    )
55
    {
56
        return new self(
57
            sprintf(
58
                'Unable to use connection to AMQP broker [%s:%d] because it is closed.',
59
                $options->getHost(),
60
                $options->getPort()
61
            ),
62
            0,
63
            $previous
64
        );
65
    }
66
67
    /**
68
     * Create an exception that indicates that the credentials specified in the
@@ 153-170 (lines=18) @@
150
     * @param \Exception|null $previous The exception that caused this exception, if any.
151
     * @return AMQPConnectionException
152
     */
153
    public static function heartbeatTimedOut(
154
        ConnectionOptions $options,
155
        $heartbeatInterval,
156
        \Exception $previous = null
157
    )
158
    {
159
        return new self(
160
            sprintf(
161
                'The AMQP connection with broker [%s:%d] has timed out, '
162
                . 'the last heartbeat was received over %d seconds ago.',
163
                $options->getHost(),
164
                $options->getPort(),
165
                $heartbeatInterval
166
            ),
167
            0,
168
            $previous
169
        );
170
    }
171
172
    /**
173
     * Create an exception that indicates an unexpected closure of the
@@ 180-194 (lines=15) @@
177
     * @param \Exception|null $previous The exception that caused this exception, if any.
178
     * @return AMQPConnectionException
179
     */
180
    public static function closedUnexpectedly(
181
        ConnectionOptions $options,
182
        \Exception $previous = null
183
    )
184
    {
185
        return new self(
186
            sprintf(
187
                'The AMQP connection with broker [%s:%d] was closed unexpectedly.',
188
                $options->getHost(),
189
                $options->getPort()
190
            ),
191
            0,
192
            $previous
193
        );
194
    }
195
}
196