Code Duplication    Length = 13-15 lines in 10 locations

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

@@ 252-265 (lines=14) @@
249
     * @throws InvalidParameterException
250
     * @throws ConflictException
251
     */
252
    public function addLog($logChannelName, $configuration)
253
    {
254
        $uri = "asterisk/logging/$logChannelName";
255
256
        try {
257
            $this->client->getEndpoint()->post($uri, [
258
                'form_params' => [
259
                    'configuration' => $configuration
260
                ]
261
            ]);
262
        } catch (RequestException $e) {
263
            $this->processRequestException($e);
264
        }
265
    }
266
267
    /**
268
     * Deletes a log channel.
@@ 341-355 (lines=15) @@
338
     * @param string $value The value to set the variable to
339
     * @throws InvalidParameterException
340
     */
341
    public function setGlobalVar($variable, $value = null)
342
    {
343
        $uri = 'asterisk/variable';
344
345
        try {
346
            $this->client->getEndpoint()->post($uri, [
347
                'form_params' => [
348
                    'variable' => $variable,
349
                    'value' => $value
350
                ]
351
            ]);
352
        } catch (RequestException $e) {
353
            $this->processRequestException($e);
354
        }
355
    }
356
357
    /**
358
     * Set the value of a global variable.

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

@@ 141-154 (lines=14) @@
138
     * @throws ConflictException
139
     * @throws UnprocessableEntityException
140
     */
141
    public function addChannel($bridgeId, $channel, $role = null)
142
    {
143
        $uri = "bridges/$bridgeId/addChannel";
144
        try {
145
            $this->client->getEndpoint()->post($uri, [
146
                'form_params' => [
147
                    'channel' => $channel,
148
                    'role' => $role,
149
                ]
150
            ]);
151
        } catch (RequestException $e) {
152
            $this->processRequestException($e);
153
        }
154
    }
155
156
    /**
157
     * Remove a channel from a bridge.
@@ 166-178 (lines=13) @@
163
     * @throws ConflictException
164
     * @throws UnprocessableEntityException
165
     */
166
    public function removeChannel($bridgeId, $channel)
167
    {
168
        $uri = "bridges/$bridgeId/removeChannel";
169
        try {
170
            $this->client->getEndpoint()->post($uri, [
171
                'form_params' => [
172
                    'channel' => $channel,
173
                ]
174
            ]);
175
        } catch (RequestException $e) {
176
            $this->processRequestException($e);
177
        }
178
    }
179
180
    /**
181
     * Set a channel as the video source in a multi-party mixing bridge. This operation has no effect on bridges with

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

@@ 275-287 (lines=13) @@
272
     * @throws UnprocessableEntityException
273
     * @throws PreconditionFailedException
274
     */
275
    public function redirect($channelId, $endpoint)
276
    {
277
        $uri = "channels/$channelId/redirect";
278
        try {
279
            $this->client->getEndpoint()->post($uri, [
280
                'form_params' => [
281
                    'endpoint' => $endpoint
282
                ]
283
            ]);
284
        } catch (RequestException $e) {
285
            $this->processRequestException($e);
286
        }
287
    }
288
289
    /**
290
     * Answer a channel.
@@ 379-391 (lines=13) @@
376
     * @throws NotFoundException
377
     * @throws ConflictException
378
     */
379
    public function mute($channelId, $direction)
380
    {
381
        $uri = "channels/$channelId/mute";
382
        try {
383
            $this->client->getEndpoint()->post($uri, [
384
                'form_params' => [
385
                    'direction' => $direction,
386
                ]
387
            ]);
388
        } catch (RequestException $e) {
389
            $this->processRequestException($e);
390
        }
391
    }
392
393
    /**
394
     * Unmute a channel.

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

@@ 84-96 (lines=13) @@
81
     * @throws ConflictException
82
     * @throws NotFoundException
83
     */
84
    public function updateDeviceState($deviceName, $deviceState)
85
    {
86
        $uri = "deviceStates/$deviceName";
87
        try {
88
            $this->client->getEndpoint()->put($uri, [
89
                'form_params' => [
90
                    'deviceState' => $deviceState,
91
                ]
92
            ]);
93
        } catch (RequestException $e) {
94
            $this->processRequestException($e);
95
        }
96
    }
97
98
    /**
99
     * Destroy a device-state controlled by ARI.

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

@@ 78-91 (lines=14) @@
75
     * @param int $newMessages (required) Count of new messages in the mailbox
76
     * @throws NotFoundException
77
     */
78
    public function updateMailbox($mailboxName, $oldMessages, $newMessages)
79
    {
80
        $uri = "mailboxes/$mailboxName";
81
        try {
82
            $this->client->getEndpoint()->put($uri, [
83
                'form_params' => [
84
                    'newMessages' => $newMessages,
85
                    'oldMessages' => $oldMessages,
86
                ]
87
            ]);
88
        } catch (RequestException $e) {
89
            $this->processRequestException($e);
90
        }
91
    }
92
93
    /**
94
     * Destroy a mailbox.

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

@@ 52-64 (lines=13) @@
49
     * @throws NotFoundException
50
     * @throws ConflictException
51
     */
52
    public function startMusicOnHold($id, $mohClass)
53
    {
54
        $uri = "{$this->getType()}/$id/moh";
55
        try {
56
            $this->client->getEndpoint()->post($uri, [
57
                'form_params' => [
58
                    'mohClass' => $mohClass,
59
                ]
60
            ]);
61
        } catch (RequestException $e) {
62
            $this->processRequestException($e);
63
        }
64
    }
65
66
    /**
67
     * Stop playing music on hold to a channel.

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

@@ 85-97 (lines=13) @@
82
     * @throws InvalidParameterException
83
     * @throws NotFoundException
84
     */
85
    public function controlPlayback($playbackId, $operation)
86
    {
87
        $uri = "playbacks/$playbackId/control";
88
        try {
89
            $this->client->getEndpoint()->post($uri, [
90
                'form_params' => [
91
                    'operation' => $operation,
92
                ]
93
            ]);
94
        } catch (RequestException $e) {
95
            $this->processRequestException($e);
96
        }
97
    }
98
}
99