Code Duplication    Length = 11-11 lines in 3 locations

Rpc/SingleRequestApi.php 3 locations

@@ 14-24 (lines=11) @@
11
abstract class SingleRequestApi implements Counter, Searcher, Finder
12
{
13
    /** {@inheritdoc} */
14
    public function count(RpcClientInterface $client, ApiMetadata $metadata, array $parameters)
15
    {
16
        $request  = $this->createCountRequest($metadata, $parameters);
17
        $response = $client->invoke($request)->getResponse($request);
18
19
        if (!$response->isSuccessful()) {
20
            throw ApiCallException::callFailed($response);
21
        }
22
23
        return (int)$response->getBody();
24
    }
25
26
    /** {@inheritdoc} */
27
    public function find(RpcClientInterface $client, ApiMetadata $metadata, array $identifier)
@@ 27-37 (lines=11) @@
24
    }
25
26
    /** {@inheritdoc} */
27
    public function find(RpcClientInterface $client, ApiMetadata $metadata, array $identifier)
28
    {
29
        $request  = $this->createFindRequest($metadata, $identifier);
30
        $response = $client->invoke([$request])->getResponse($request);
31
32
        if (!$response->isSuccessful()) {
33
            throw ApiCallException::callFailed($response);
34
        }
35
36
        return $response->getBody();
37
    }
38
39
    /** {@inheritdoc} */
40
    public function search(RpcClientInterface $client, ApiMetadata $metadata, array $parameters)
@@ 40-50 (lines=11) @@
37
    }
38
39
    /** {@inheritdoc} */
40
    public function search(RpcClientInterface $client, ApiMetadata $metadata, array $parameters)
41
    {
42
        $request  = $this->createSearchRequest($metadata, $parameters);
43
        $response = $client->invoke($request)->getResponse($request);
44
45
        if (!$response->isSuccessful()) {
46
            throw ApiCallException::callFailed($response);
47
        }
48
49
        return new \ArrayIterator($response->getBody());
50
    }
51
52
    /**
53
     * @param ApiMetadata $metadata