Code Duplication    Length = 12-13 lines in 10 locations

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

@@ 41-52 (lines=12) @@
38
     *
39
     * @return Application[]
40
     */
41
    public function getApplications()
42
    {
43
        $uri = 'applications';
44
        $response = $this->client->getEndpoint()->get($uri);
45
46
        $applications = [];
47
        foreach (\GuzzleHttp\json_decode($response->getBody()) as $application) {
48
            $applications[] = new Application($this->client, $application);
49
        }
50
51
        return $applications;
52
    }
53
54
    /**
55
     * Get details of an application.

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

@@ 150-162 (lines=13) @@
147
     *
148
     * @return Module[]
149
     */
150
    public function listModules()
151
    {
152
        $uri = 'asterisk/modules';
153
154
        $response = $this->client->getEndpoint()->get($uri);
155
156
        $modules = [];
157
        foreach (\GuzzleHttp\json_decode($response->getBody()) as $module) {
158
            $modules[] = new Module($module);
159
        }
160
161
        return $modules;
162
    }
163
164
    /**
165
     * Get Asterisk module information.
@@ 230-242 (lines=13) @@
227
     *
228
     * @return LogChannel[]
229
     */
230
    public function listLogChannels()
231
    {
232
        $uri = 'asterisk/logging';
233
234
        $response = $this->client->getEndpoint()->get($uri);
235
236
        $logChannels = [];
237
        foreach (\GuzzleHttp\json_decode($response->getBody()) as $logChannel) {
238
            $logChannels[] = new Module($logChannel);
239
        }
240
241
        return $logChannels;
242
    }
243
244
    /**
245
     * Adds a log channel.

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

@@ 40-51 (lines=12) @@
37
     *
38
     * @return Bridge[]
39
     */
40
    public function getBridges()
41
    {
42
        $uri = 'bridges';
43
        $response = $this->client->getEndpoint()->get($uri);
44
45
        $bridges = [];
46
        foreach (\GuzzleHttp\json_decode($response->getBody()) as $bridge) {
47
            $bridges[] = new Bridge($this->client, $bridge);
48
        }
49
50
        return $bridges;
51
    }
52
53
    /**
54
     * Create a new bridge. This bridge persists until it has been shut down, or Asterisk has been shut down.

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

@@ 57-68 (lines=12) @@
54
     *
55
     * @return Channel[]
56
     */
57
    public function getChannels()
58
    {
59
        $uri = 'channels';
60
        $response = $this->client->getEndpoint()->get($uri);
61
62
        $channels = [];
63
        foreach (\GuzzleHttp\json_decode($response->getBody()) as $channel) {
64
            $channels[] = new Channel($this->client, $channel);
65
        }
66
67
        return $channels;
68
    }
69
70
    /**
71
     * Create a new channel (originate). The new channel is created immediately and a snapshot of it

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

@@ 49-60 (lines=12) @@
46
     *
47
     * @return DeviceState[]
48
     */
49
    public function getDeviceStates()
50
    {
51
        $uri = 'deviceStates';
52
        $response = $this->client->getEndpoint()->get($uri);
53
54
        $deviceStates = [];
55
        foreach (\GuzzleHttp\json_decode($response->getBody()) as $deviceState) {
56
            $deviceStates[] = new DeviceState($this->client, $deviceState);
57
        }
58
59
        return $deviceStates;
60
    }
61
62
    /**
63
     * Retrieve the current state of a device.

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

@@ 43-54 (lines=12) @@
40
     *
41
     * @return Endpoint
42
     */
43
    public function getEndpoints()
44
    {
45
        $uri = 'endpoints';
46
        $response = $this->client->getEndpoint()->get($uri);
47
48
        $endpoints = [];
49
        foreach (\GuzzleHttp\json_decode($response->getBody()) as $endpoint) {
50
            $endpoints[] = new Endpoint($this->client, $endpoint);
51
        }
52
53
        return $endpoints;
54
    }
55
56
    /**
57
     * Send a message to some technology URI or endpoint.

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

@@ 38-49 (lines=12) @@
35
     *
36
     * @return Mailbox[]
37
     */
38
    public function getMailboxes()
39
    {
40
        $uri = 'mailboxes';
41
        $response = $this->client->getEndpoint()->get($uri);
42
43
        $mailboxes = [];
44
        foreach (\GuzzleHttp\json_decode($response->getBody()) as $mailbox) {
45
            $mailboxes[] = new Mailbox($mailbox);
46
        }
47
48
        return $mailboxes;
49
    }
50
51
    /**
52
     * Retrieve the current state of a mailbox.

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

@@ 40-51 (lines=12) @@
37
     *
38
     * @return StoredRecording[]
39
     */
40
    public function getRecordings()
41
    {
42
        $uri = 'recordings/stored';
43
        $response = $this->client->getEndpoint()->get($uri);
44
45
        $recordings = [];
46
        foreach (\GuzzleHttp\json_decode($response->getBody()) as $recording) {
47
            $recordings[] = new StoredRecording($recording);
48
        }
49
50
        return $recordings;
51
    }
52
53
    /**
54
     * Get a stored recording's details.

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

@@ 36-47 (lines=12) @@
33
     *
34
     * @return Sound[]
35
     */
36
    public function getSounds()
37
    {
38
        $uri = 'sounds';
39
        $response = $this->client->getEndpoint()->get($uri);
40
41
        $sounds = [];
42
        foreach (\GuzzleHttp\json_decode($response->getBody()) as $sound) {
43
            $sounds[] = new Sound($sound);
44
        }
45
46
        return $sounds;
47
    }
48
49
    /**
50
     * Get a sound's details.