Code Duplication    Length = 15-20 lines in 2 locations

PHPDaemon/Servers/HTTP/Connection.php 1 location

@@ 245-264 (lines=20) @@
242
     */
243
    protected function onRead()
244
    {
245
        if (!$this->policyReqNotFound) {
246
            $d = $this->drainIfMatch("<policy-file-request/>\x00");
247
            if ($d === null) { // partially match
248
                return;
249
            }
250
            if ($d) {
251
                $FP = \PHPDaemon\Servers\FlashPolicy\Pool::getInstance(
252
                    $this->pool->config->fpsname->value,
253
                    false
254
                );
255
                if ($FP && $FP->policyData
256
                ) {
257
                    $this->write($FP->policyData . "\x00");
258
                }
259
                $this->finish();
260
                return;
261
            } else {
262
                $this->policyReqNotFound = true;
263
            }
264
        }
265
        start:
266
        if ($this->finished) {
267
            return;

PHPDaemon/Servers/WebSocket/Connection.php 1 location

@@ 359-373 (lines=15) @@
356
     */
357
    protected function onRead()
358
    {
359
        if (!$this->policyReqNotFound) {
360
            $d = $this->drainIfMatch("<policy-file-request/>\x00");
361
            if ($d === null) { // partially match
362
                return;
363
            }
364
            if ($d) {
365
                if (($FP = \PHPDaemon\Servers\FlashPolicy\Pool::getInstance($this->pool->config->fpsname->value,
366
                        false)) && $FP->policyData
367
                ) {
368
                    $this->write($FP->policyData . "\x00");
369
                }
370
                $this->finish();
371
                return;
372
            } else {
373
                $this->policyReqNotFound = true;
374
            }
375
        }
376
        start: