Code Duplication    Length = 20-22 lines in 2 locations

src/Kunstmaan/NodeBundle/Helper/NodeAdmin/NodeAdminPublisher.php 2 locations

@@ 265-286 (lines=22) @@
262
        return $newNodeVersion;
263
    }
264
265
    public function chooseHowToPublish(Request $request, NodeTranslation $nodeTranslation, TranslatorInterface $translator)
266
    {
267
        /** @var Session $session */
268
        $session = $request->getSession();
269
270
        if ($request->request->has('publish_later') && $request->get('pub_date')) {
271
            $date = new \DateTime(
272
                $request->get('pub_date') . ' ' . $request->get('pub_time')
273
            );
274
            $this->publishLater($nodeTranslation, $date);
275
            $session->getFlashBag()->add(
276
                FlashTypes::SUCCESS,
277
                $translator->trans('kuma_node.admin.publish.flash.success_scheduled')
278
            );
279
        } else {
280
            $this->publish($nodeTranslation);
281
            $session->getFlashBag()->add(
282
                FlashTypes::SUCCESS,
283
                $translator->trans('kuma_node.admin.publish.flash.success_published')
284
            );
285
        }
286
    }
287
288
    public function chooseHowToUnpublish(Request $request, NodeTranslation $nodeTranslation, TranslatorInterface $translator)
289
    {
@@ 288-307 (lines=20) @@
285
        }
286
    }
287
288
    public function chooseHowToUnpublish(Request $request, NodeTranslation $nodeTranslation, TranslatorInterface $translator)
289
    {
290
        /** @var Session $session */
291
        $session = $request->getSession();
292
293
        if ($request->request->has('unpublish_later') && $request->get('unpub_date')) {
294
            $date = new \DateTime($request->get('unpub_date') . ' ' . $request->get('unpub_time'));
295
            $this->unPublishLater($nodeTranslation, $date);
296
            $session->getFlashBag()->add(
297
                FlashTypes::SUCCESS,
298
                $translator->trans('kuma_node.admin.unpublish.flash.success_scheduled')
299
            );
300
        } else {
301
            $this->unPublish($nodeTranslation);
302
            $session->getFlashBag()->add(
303
                FlashTypes::SUCCESS,
304
                $translator->trans('kuma_node.admin.unpublish.flash.success_unpublished')
305
            );
306
        }
307
    }
308
}
309