Code Duplication    Length = 20-20 lines in 2 locations

src/Palladium/Service/Search.php 2 locations

@@ 42-61 (lines=20) @@
39
     *
40
     * @return Palladium\Entity\Identity
41
     */
42
    public function findIdentityById($identityId)
43
    {
44
        $identity = new Entity\Identity;
45
        $identity->setId($identityId);
46
47
        $mapper = $this->mapperFactory->create(Mapper\Identity::class);
48
        $mapper->fetch($identity);
49
50
        if ($identity->getAccountId() === null) {
51
            $this->logger->notice('identity not found', [
52
                'input' => [
53
                    'id' => $identityId,
54
                ],
55
            ]);
56
57
            throw new IdentityNotFound;
58
        }
59
60
        return $identity;
61
    }
62
63
64
    /**
@@ 73-92 (lines=20) @@
70
     *
71
     * @return Palladium\Entity\EmailIdentity
72
     */
73
    public function findEmailIdentityByEmailAddress(string $emailAddress)
74
    {
75
        $identity = new Entity\EmailIdentity;
76
        $identity->setEmailAddress($emailAddress);
77
78
        $mapper = $this->mapperFactory->create(Mapper\EmailIdentity::class);
79
        $mapper->fetch($identity);
80
81
        if ($identity->getId() === null) {
82
            $this->logger->notice('identity not found', [
83
                'input' => [
84
                    'email' => $emailAddress,
85
                ],
86
            ]);
87
88
            throw new IdentityNotFound;
89
        }
90
91
        return $identity;
92
    }
93
94
95
    /**