Code Duplication    Length = 5-5 lines in 4 locations

Run/Loop.php 4 locations

@@ 246-250 (lines=5) @@
243
    {
244
        $this->run->setLastHeartbeatAt(new \DateTime());
245
        $this->run->setElapsed(microtime(true) - $start);
246
        if ($this->runManager instanceof BaseRunManager) {
247
            $objectManager = $this->runManager->getObjectManager();
248
            $objectManager->persist($this->run);
249
            $objectManager->flush();
250
        }
251
    }
252
253
    /**
@@ 259-263 (lines=5) @@
256
    protected function updateProcessed($count)
257
    {
258
        $this->run->setProcessed($count);
259
        if ($this->runManager instanceof BaseRunManager) {
260
            $objectManager = $this->runManager->getObjectManager();
261
            $objectManager->persist($this->run);
262
            $objectManager->flush();
263
        }
264
    }
265
266
    /**
@@ 289-293 (lines=5) @@
286
        $this->run->setHostname(gethostname());
287
        $this->run->setPid(getmypid());
288
        $this->run->setProcessed(0);
289
        if ($this->runManager instanceof BaseRunManager) {
290
            $objectManager = $this->runManager->getObjectManager();
291
            $objectManager->persist($this->run);
292
            $objectManager->flush();
293
        }
294
    }
295
296
    /**
@@ 307-311 (lines=5) @@
304
            $this->run->setEndedAt($endedTime);
305
        }
306
        $this->run->setElapsed($end - $start);
307
        if ($this->runManager instanceof BaseRunManager) {
308
            $objectManager = $this->runManager->getObjectManager();
309
            $objectManager->remove($this->run);
310
            $objectManager->flush();
311
        }
312
        $this->log('info', 'Ended with '.$this->run->getProcessed().' job(s) processed over '.strval($this->run->getElapsed()).' seconds.');
313
    }
314