Code Duplication    Length = 17-17 lines in 2 locations

src/Event/Listener/ItemChangesListener.php 2 locations

@@ 99-115 (lines=17) @@
96
    /**
97
     * @param LifecycleEventArgs $args
98
     */
99
    public function postRemove(LifecycleEventArgs $args)
100
    {
101
        $entity = $args->getEntity();
102
        if ($entity instanceof ItemCatalog && $this->sync_remove) {
103
            if ($id = $this->getId($entity, $args->getEntityManager())) {
104
                $this->client->sendAction(Client::ACTION_UPDATE, $id, $this->renderEntry($entity));
105
            } else {
106
                $notice = new Notice();
107
                $notice->setMessage($this->templating->render(
108
                    'AnimeDbMyAnimeListSyncBundle:Notice:failed_delete.html.twig',
109
                    ['item' => $entity]
110
                ));
111
                $args->getEntityManager()->persist($notice);
112
                $args->getEntityManager()->flush();
113
            }
114
        }
115
    }
116
117
    /**
118
     * Pre persist add item source if not exists
@@ 133-149 (lines=17) @@
130
    /**
131
     * @param LifecycleEventArgs $args
132
     */
133
    public function postPersist(LifecycleEventArgs $args)
134
    {
135
        $entity = $args->getEntity();
136
        if ($entity instanceof ItemCatalog && $this->sync_insert) {
137
            if ($id = $this->getId($entity, $args->getEntityManager())) {
138
                $this->client->sendAction(Client::ACTION_ADD, $id, $this->renderEntry($entity));
139
            } else {
140
                $notice = new Notice();
141
                $notice->setMessage($this->templating->render(
142
                    'AnimeDbMyAnimeListSyncBundle:Notice:failed_insert.html.twig',
143
                    ['item' => $entity]
144
                ));
145
                $args->getEntityManager()->persist($notice);
146
                $args->getEntityManager()->flush();
147
            }
148
        }
149
    }
150
151
    /**
152
     * Pre update add item source if not exists