Code Duplication    Length = 16-16 lines in 2 locations

src/Weew/HttpServer/HttpServer.php 2 locations

@@ 204-219 (lines=16) @@
201
    /**
202
     * @throws Exception
203
     */
204
    protected function waitForServerToStart() {
205
        if ($this->waitForServer > 0) {
206
            $timer = $this->createTimer();
207
            $timer->start();
208
209
            while ( ! $this->isRunning()) {
210
                if ($timer->getDuration() < $this->waitForServer) {
211
                    usleep(100000); // 0.1 second
212
                } else {
213
                    throw new Exception(
214
                        s('Could not start server after %d seconds.', $this->waitForServer)
215
                    );
216
                }
217
            }
218
        }
219
    }
220
221
    /**
222
     * @throws Exception
@@ 224-239 (lines=16) @@
221
    /**
222
     * @throws Exception
223
     */
224
    protected function waitForServerToStop() {
225
        if ($this->waitForServer > 0) {
226
            $timer = $this->createTimer();
227
            $timer->start();
228
229
            while ($this->isRunning()) {
230
                if ($timer->getDuration() < $this->waitForServer) {
231
                    usleep(100000); // 0.1 second
232
                } else {
233
                    throw new Exception(
234
                        s('Could not stop server after %d seconds.', $this->waitForServer)
235
                    );
236
                }
237
            }
238
        }
239
    }
240
241
    /**
242
     * @return ITimer