Completed
Push — master ( a5e5f2...dcb46f )
by Brian
02:47
created

Sounds::getSound()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1.0156

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
ccs 3
cts 4
cp 0.75
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
crap 1.0156
1
<?php
2
3
/*
4
 * Copyright 2014 Brian Smith <[email protected]>.
5
 *
6
 * Licensed under the Apache License, Version 2.0 (the "License");
7
 * you may not use this file except in compliance with the License.
8
 * You may obtain a copy of the License at
9
 *
10
 *      http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS,
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * See the License for the specific language governing permissions and
16
 * limitations under the License.
17
 */
18
19
namespace phparia\Api;
20
21
use phparia\Client\AriClientAware;
22
use phparia\Resources\Sound;
23
24
/**
25
 * Sounds API
26
 *
27
 * @author Brian Smith <[email protected]>
28
 */
29
class Sounds extends AriClientAware
30
{
31
    /**
32
     * List all sounds.
33
     *
34
     * @return Sound[]
35
     */
36 1
    public function getSounds()
37
    {
38 1
        $uri = '/sounds';
39 1
        $response = $this->client->getEndpoint()->get($uri);
40
41
        $sounds = [];
42
        foreach ((array)$response as $sound) {
43
            $sounds[] = new Sound($sound);
44
        }
45
46
        return $sounds;
47
    }
48
49
    /**
50
     * Get a sound's details.
51
     *
52
     * @param string $soundId Sound's id
53
     * @return Sound
54
     */
55 1
    public function getSound($soundId)
56
    {
57 1
        $uri = "/sounds/$soundId";
58 1
        $response = $this->client->getEndpoint()->get($uri);
59
60
        return new Sound($response);
61
    }
62
}
63