Code Duplication    Length = 16-17 lines in 2 locations

src/wormling/phparia/Api/Asterisk.php 1 location

@@ 55-71 (lines=17) @@
52
     * @return ConfigTuple[]
53
     * @throws NotFoundException
54
     */
55
    public function getObject($configClass, $objectType, $id)
56
    {
57
        $uri = "asterisk/config/dynamic/$configClass/$objectType/$id";
58
59
        try {
60
            $response = $this->client->getEndpoint()->get($uri);
61
        } catch (RequestException $e) {
62
            $this->processRequestException($e);
63
        }
64
65
        $configTuples = [];
66
        foreach (\GuzzleHttp\json_decode($response->getBody()) as $configTuple) {
67
            $configTuples[] = new ConfigTuple($configTuple);
68
        }
69
70
        return $configTuples;
71
    }
72
73
    /**
74
     * Create or update a dynamic configuration object.

src/wormling/phparia/Api/Endpoints.php 1 location

@@ 89-104 (lines=16) @@
86
     * @return \phparia\Resources\Endpoint[]
87
     * @throws NotFoundException
88
     */
89
    public function getEndpointsByTech($tech)
90
    {
91
        $uri = "endpoints/$tech";
92
        try {
93
            $response = $this->client->getEndpoint()->get($uri);
94
        } catch (RequestException $e) {
95
            $this->processRequestException($e);
96
        }
97
98
        $endpoints = [];
99
        foreach (\GuzzleHttp\json_decode($response->getBody()) as $endpoint) {
100
            $endpoints[] = new Endpoint($this->client, $endpoint);
101
        }
102
103
        return $endpoints;
104
    }
105
106
    /**
107
     * Details for an endpoint.