Code Duplication    Length = 36-37 lines in 2 locations

src/Surfnet/StepupMiddlewareClient/Configuration/Service/RaLocationService.php 1 location

@@ 27-62 (lines=36) @@
24
use Surfnet\StepupMiddlewareClient\Exception\ResourceReadException;
25
use Surfnet\StepupMiddlewareClient\Service\ApiService;
26
27
class RaLocationService
28
{
29
    /**
30
     * @var ApiService
31
     */
32
    private $apiService;
33
34
    /**
35
     * @param ApiService $apiService
36
     */
37
    public function __construct(ApiService $apiService)
38
    {
39
        $this->apiService = $apiService;
40
    }
41
42
    /**
43
     * @param string $id The RA's locations ID.
44
     * @return null|array
45
     * @throws AccessDeniedToResourceException When the consumer isn't authorised to access given resource.
46
     * @throws ResourceReadException When the server doesn't respond with the resource.
47
     * @throws MalformedResponseException When the server doesn't respond with (well-formed) JSON.
48
     */
49
    public function get($id)
50
    {
51
        return $this->apiService->read('ra-location/%s', [$id]);
52
    }
53
54
    /**
55
     * @param RaLocationSearchQuery $searchQuery
56
     * @return mixed|null
57
     */
58
    public function search(RaLocationSearchQuery $searchQuery)
59
    {
60
        return $this->apiService->read('ra-location' . $searchQuery->toHttpQuery());
61
    }
62
}
63

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

@@ 24-60 (lines=37) @@
21
use Surfnet\StepupMiddlewareClient\Identity\Dto\RaListingSearchQuery;
22
use Surfnet\StepupMiddlewareClient\Service\ApiService;
23
24
class RaListingService
25
{
26
    /**
27
     * @var ApiService
28
     */
29
    private $apiService;
30
31
    /**
32
     * @param ApiService $apiService
33
     */
34
    public function __construct(ApiService $apiService)
35
    {
36
        $this->apiService = $apiService;
37
    }
38
39
    /**
40
     * @param string $id The RA's identity ID.
41
     * @param string $institution The institution.
42
     * @return null|array
43
     * @throws AccessDeniedToResourceException When the consumer isn't authorised to access given resource.
44
     * @throws ResourceReadException When the server doesn't respond with the resource.
45
     * @throws MalformedResponseException When the server doesn't respond with (well-formed) JSON.
46
     */
47
    public function get($id, $institution, $actorId)
48
    {
49
        return $this->apiService->read('ra-listing/%s/%s?actorId=%s', [$id, $institution, $actorId]);
50
    }
51
52
    /**
53
     * @param RaListingSearchQuery $searchQuery
54
     * @return mixed|null
55
     */
56
    public function search(RaListingSearchQuery $searchQuery)
57
    {
58
        return $this->apiService->read('ra-listing' . $searchQuery->toHttpQuery());
59
    }
60
}
61