Code Duplication    Length = 12-14 lines in 2 locations

src/InMemoryRepository.php 1 location

@@ 345-356 (lines=12) @@
342
    /**
343
     * @param EntityChangedEvent $e
344
     */
345
    protected function triggerAttributesChange(EntityChangedEvent $e)
346
    {
347
        $changedEntity = $e->getChangedEntity();
348
349
        $originalAttrs = $e->getOriginalEntity()->extract();
350
        $changedAttrs = $changedEntity->extract();
351
352
        foreach (array_keys(array_diff_assoc($originalAttrs, $changedAttrs)) as $attribute) {
353
            $e->setName($this->getAttributeChangeEventName($changedEntity, $attribute));
354
            $this->eventManager->triggerEvent($e);
355
        }
356
    }
357
358
    /**
359
     * @param EntityInterface $changedEntity

src/Repository.php 1 location

@@ 358-371 (lines=14) @@
355
    /**
356
     * @param EntityChangedEvent $e
357
     */
358
    protected function triggerAttributesChange(EntityChangedEvent $e)
359
    {
360
        $changedEntity = $e->getChangedEntity();
361
362
        $this->eventManager->addIdentifiers([get_class($changedEntity)]);
363
364
        $originalAttrs = $e->getOriginalEntity()->extract();
365
        $changedAttrs = $changedEntity->extract();
366
367
        foreach (array_keys(array_diff_assoc($originalAttrs, $changedAttrs)) as $attribute) {
368
            $e->setName($this->getAttributeChangeEventName($changedEntity, $attribute));
369
            $this->eventManager->triggerEvent($e);
370
        }
371
    }
372
373
    /**
374
     * @param EntityInterface $changedEntity