Code Duplication    Length = 4-5 lines in 3 locations

src/Skobkin/Bundle/PointToolsBundle/Service/Factory/UserFactory.php 1 location

@@ 48-52 (lines=5) @@
45
        $this->validateArrayData($data);
46
47
        /** @var User $user */
48
        if (null === ($user = $this->userRepository->find($data['id']))) {
49
            // Creating new user
50
            $user = new User($data['id']);
51
            $this->em->persist($user);
52
        }
53
54
        // Updating data
55
        $user

src/Skobkin/Bundle/PointToolsBundle/Service/UserApi.php 2 locations

@@ 278-282 (lines=5) @@
275
        // @todo Refactor to UserFactory->createFromArray()
276
        if (array_key_exists('id', $userInfo) && array_key_exists('login', $userInfo) && array_key_exists('name', $userInfo) && is_numeric($userInfo['id'])) {
277
            /** @var User $user */
278
            if (null === ($user = $this->userRepository->find($userInfo['id']))) {
279
                // Creating new user
280
                $user = new User($userInfo['id']);
281
                $this->em->persist($user);
282
            }
283
284
            // Updating data
285
            $user
@@ 317-320 (lines=4) @@
314
            if (array_key_exists('id', $userInfo) && array_key_exists('login', $userInfo) && array_key_exists('name', $userInfo) && is_numeric($userInfo['id'])) {
315
316
                // @todo Optimize with prehashed id's list
317
                if (null === ($user = $this->userRepository->find($userInfo['id']))) {
318
                    $user = new User((int) $userInfo['id']);
319
                    $this->em->persist($user);
320
                }
321
322
                // Updating data
323
                $user