Code Duplication    Length = 8-9 lines in 2 locations

src/Loom/AbstractLoom.php 2 locations

@@ 292-299 (lines=8) @@
289
     */
290
    public function add($loom)
291
    {
292
        switch (get_parent_class($loom)) {
293
            case 'Loom\Loom':
294
            case 'Loom\AbstractLoom':
295
                $this->ms = $this->ms + $loom->getMilliseconds();
296
                break;
297
            case 'Loom\AbstractUnit':
298
                $this->ms = $this->ms + $loom->toMilliseconds();
299
        }
300
301
        return $this;
302
    }
@@ 314-322 (lines=9) @@
311
     */
312
    public function sub($loom)
313
    {
314
        switch(get_parent_class($loom)) {
315
            case 'Loom\Loom':
316
            case 'Loom\AbstractLoom':
317
                $this->ms = $this->ms - $loom->getMilliseconds();
318
                break;
319
            case 'Loom\AbstractUnit':
320
                $this->ms = $this->ms - $loom->toMilliseconds();
321
                break;
322
        }
323
324
        if ($this->ms < 0) {
325
            $this->ms = 0;