Code Duplication    Length = 14-16 lines in 3 locations

src/Surfnet/StepupMiddlewareClientBundle/Identity/Service/IdentityService.php 2 locations

@@ 58-72 (lines=15) @@
55
     * @param string $id
56
     * @return null|Identity
57
     */
58
    public function get($id)
59
    {
60
        $data = $this->service->get($id);
61
62
        if ($data === null) {
63
            return null;
64
        }
65
66
        $identity = Identity::fromData($data);
67
68
        $message = sprintf("Identity '%s' retrieved from the Middleware is invalid", $id);
69
        $this->assertIsValid($identity, $message);
70
71
        return $identity;
72
    }
73
74
    /**
75
     * @param IdentitySearchQuery $searchQuery
@@ 93-108 (lines=16) @@
90
     * @param Identity $identity
91
     * @return RegistrationAuthorityCredentials|null
92
     */
93
    public function getRegistrationAuthorityCredentials(Identity $identity)
94
    {
95
        $data = $this->service->getRegistrationAuthorityCredentials($identity->id);
96
97
        // 404 Not Found is a valid case.
98
        if (!$data) {
99
            return null;
100
        }
101
102
        $credentials = RegistrationAuthorityCredentials::fromData($data);
103
104
        $message = sprintf('Registration Authority Credentials for Identity[%s] are invalid', $identity->id);
105
        $this->assertIsValid($credentials, $message);
106
107
        return $credentials;
108
    }
109
110
    /**
111
     * @param object      $value

src/Surfnet/StepupMiddlewareClientBundle/Identity/Service/RaListingService.php 1 location

@@ 57-70 (lines=14) @@
54
     * @param string $id
55
     * @return null|RaListing
56
     */
57
    public function get($id)
58
    {
59
        $data = $this->service->get($id);
60
61
        if ($data === null) {
62
            return null;
63
        }
64
65
        $raListing = RaListing::fromData($data);
66
        $message = sprintf("RaListing '%s' retrieved from the Middleware is invalid", $id);
67
        $this->assertIsValid($raListing, $message);
68
69
        return $raListing;
70
    }
71
72
    /**
73
     * @param RaListingSearchQuery $searchQuery