Code Duplication    Length = 11-12 lines in 10 locations

src/wormling/phparia/Api/Applications.php 2 locations

@@ 61-71 (lines=11) @@
58
     * @return Application
59
     * @throws NotFoundException
60
     */
61
    public function getApplication($applicationName)
62
    {
63
        $uri = "applications/$applicationName";
64
        try {
65
            $response = $this->client->getEndpoint()->get($uri);
66
        } catch (RequestException $e) {
67
            $this->processRequestException($e);
68
        }
69
70
        return new Application($this->client, \GuzzleHttp\json_decode($response->getBody()));
71
    }
72
73
    /**
74
     * Subscribe an application to a event source. Returns the state of the application after the subscriptions have changed
@@ 110-120 (lines=11) @@
107
     * @throws NotFoundException
108
     * @throws UnprocessableEntityException
109
     */
110
    public function unsubscribe($applicationName, $eventSource)
111
    {
112
        $uri = "applications/$applicationName/subscription?eventSource=".\GuzzleHttp\json_encode($eventSource);
113
        try {
114
            $response = $this->client->getEndpoint()->delete($uri);
115
        } catch (RequestException $e) {
116
            $this->processRequestException($e);
117
        }
118
119
        return new Application($this->client, \GuzzleHttp\json_decode($response->getBody()));
120
    }
121
}
122

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

@@ 64-75 (lines=12) @@
61
     * @return Variable
62
     * @throws InvalidParameterException
63
     */
64
    public function getVariable($variable)
65
    {
66
        $uri = "asterisk/variable?variable=$variable";
67
68
        try {
69
            $response = $this->client->getEndpoint()->get($uri);
70
        } catch (RequestException $e) {
71
            $this->processRequestException($e);
72
        }
73
74
        return new Variable(\GuzzleHttp\json_decode($response->getBody()));
75
    }
76
77
    /**
78
     * Set the value of a global variable.

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

@@ 103-113 (lines=11) @@
100
     * @return Bridge
101
     * @throws NotFoundException
102
     */
103
    public function getBridge($bridgeId)
104
    {
105
        $uri = "bridges/$bridgeId";
106
        try {
107
            $response = $this->client->getEndpoint()->get($uri);
108
        } catch (RequestException $e) {
109
            $this->processRequestException($e);
110
        }
111
112
        return new Bridge($this->client, \GuzzleHttp\json_decode($response->getBody()));
113
    }
114
115
    /**
116
     * Shut down a bridge. If any channels are in this bridge, they will be removed and resume whatever they were doing beforehand.

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

@@ 134-144 (lines=11) @@
131
     * @return Channel
132
     * @throws NotFoundException
133
     */
134
    public function getChannel($channelId)
135
    {
136
        $uri = "channels/$channelId";
137
        try {
138
            $response = $this->client->getEndpoint()->get($uri);
139
        } catch (RequestException $e) {
140
            $this->processRequestException($e);
141
        }
142
143
        return new Channel($this->client, \GuzzleHttp\json_decode($response->getBody()));
144
    }
145
146
    /**
147
     * Create a new channel (originate). The new channel is created immediately and a snapshot of it

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

@@ 115-125 (lines=11) @@
112
     * @throws InvalidParameterException
113
     * @throws NotFoundException
114
     */
115
    public function getEndpointByTechAndResource($tech, $resource)
116
    {
117
        $uri = "endpoints/$tech/$resource";
118
        try {
119
            $response = $this->client->getEndpoint()->get($uri);
120
        } catch (RequestException $e) {
121
            $this->processRequestException($e);
122
        }
123
124
        return new Endpoint($this->client, \GuzzleHttp\json_decode($response->getBody()));
125
    }
126
127
    /**
128
     * Send a message to some endpoint in a technology.

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

@@ 58-68 (lines=11) @@
55
     * @return Mailbox
56
     * @throws NotFoundException
57
     */
58
    public function getMailbox($mailboxName)
59
    {
60
        $uri = "mailboxes/$mailboxName";
61
        try {
62
            $response = $this->client->getEndpoint()->get($uri);
63
        } catch (RequestException $e) {
64
            $this->processRequestException($e);
65
        }
66
67
        return new Mailbox(\GuzzleHttp\json_decode($response->getBody()));
68
    }
69
70
    /**
71
     * Change the state of a mailbox. (Note - implicitly creates the mailbox).

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

@@ 48-58 (lines=11) @@
45
     * @return Playback
46
     * @throws NotFoundException
47
     */
48
    public function getPlayback($playbackId)
49
    {
50
        $uri = "playbacks/$playbackId";
51
        try {
52
            $response = $this->client->getEndpoint()->get($uri);
53
        } catch (RequestException $e) {
54
            $this->processRequestException($e);
55
        }
56
57
        return new Playback($this->client, \GuzzleHttp\json_decode($response->getBody()));
58
    }
59
60
    /**
61
     * Stop a playback.

src/wormling/phparia/Api/Recordings.php 2 locations

@@ 60-70 (lines=11) @@
57
     * @return StoredRecording
58
     * @throws NotFoundException
59
     */
60
    public function getRecording($recordingName)
61
    {
62
        $uri = "recordings/stored/$recordingName";
63
        try {
64
            $response = $this->client->getEndpoint()->get($uri);
65
        } catch (RequestException $e) {
66
            $this->processRequestException($e);
67
        }
68
69
        return new StoredRecording(\GuzzleHttp\json_decode($response->getBody()));
70
    }
71
72
    /**
73
     * Delete a stored recording.
@@ 121-131 (lines=11) @@
118
     * @return LiveRecording
119
     * @throws NotFoundException
120
     */
121
    public function getLiveRecording($recordingName)
122
    {
123
        $uri = "recordings/live/$recordingName";
124
        try {
125
            $response = $this->client->getEndpoint()->get($uri);
126
        } catch (RequestException $e) {
127
            $this->processRequestException($e);
128
        }
129
130
        return new LiveRecording($this->client, \GuzzleHttp\json_decode($response->getBody()));
131
    }
132
133
    /**
134
     * Stop a live recording and discard it.