Code Duplication    Length = 10-12 lines in 3 locations

src/Store/Store.php 3 locations

@@ 524-535 (lines=12) @@
521
     * @param   Model   $model
522
     * @return  Model
523
     */
524
    private function doCommitCreate(Model $model)
525
    {
526
        $this->dispatchLifecycleEvent(Events::preCreate, $model);
527
528
        $this->getPersisterFor($model->getType())->create($model);
529
        $model->getState()->setNew(false);
530
        // Should the model always reload? Or should the commit be assumed correct and just clear the new/dirty state?
531
        $model->reload();
532
533
        $this->dispatchLifecycleEvent(Events::postCreate, $model);
534
        return $model;
535
    }
536
537
    /**
538
     * Performs a Model delete commit and persists to the database.
@@ 543-552 (lines=10) @@
540
     * @param   Model   $model
541
     * @return  Model
542
     */
543
    private function doCommitDelete(Model $model)
544
    {
545
        $this->dispatchLifecycleEvent(Events::preDelete, $model);
546
547
        $this->getPersisterFor($model->getType())->delete($model);
548
        $model->getState()->setDeleted();
549
550
        $this->dispatchLifecycleEvent(Events::postDelete, $model);
551
        return $model;
552
    }
553
554
    /**
555
     * Performs a Model update commit and persists to the database.
@@ 560-570 (lines=11) @@
557
     * @param   Model   $model
558
     * @return  Model
559
     */
560
    private function doCommitUpdate(Model $model)
561
    {
562
        $this->dispatchLifecycleEvent(Events::preUpdate, $model);
563
564
        $this->getPersisterFor($model->getType())->update($model);
565
        // Should the model always reload? Or should the commit be assumed correct and just clear the new/dirty state?
566
        $model->reload();
567
568
        $this->dispatchLifecycleEvent(Events::postUpdate, $model);
569
        return $model;
570
    }
571
572
    /**
573
     * Validates that an embed name/type can be set to an owning embed metadata type.