@@ -33,8 +33,7 @@ discard block |
||
33 | 33 | * @param array $recording |
34 | 34 | * @param MusicBrainz $brainz |
35 | 35 | */ |
36 | - public function __construct(array $recording, MusicBrainz $brainz) |
|
37 | - { |
|
36 | + public function __construct(array $recording, MusicBrainz $brainz) { |
|
38 | 37 | $this->data = $recording; |
39 | 38 | $this->brainz = $brainz; |
40 | 39 | |
@@ -54,8 +53,7 @@ discard block |
||
54 | 53 | * |
55 | 54 | * @return $this |
56 | 55 | */ |
57 | - public function setReleases(array $releases) |
|
58 | - { |
|
56 | + public function setReleases(array $releases) { |
|
59 | 57 | foreach ($releases as $release) { |
60 | 58 | array_push($this->releases, new Release($release, $this->brainz)); |
61 | 59 | } |
@@ -66,8 +64,7 @@ discard block |
||
66 | 64 | /** |
67 | 65 | * @return int |
68 | 66 | */ |
69 | - public function getScore() |
|
70 | - { |
|
67 | + public function getScore() { |
|
71 | 68 | return $this->score; |
72 | 69 | } |
73 | 70 | |
@@ -75,8 +72,7 @@ discard block |
||
75 | 72 | * @throws Exception |
76 | 73 | * @return array |
77 | 74 | */ |
78 | - public function getReleaseDates() |
|
79 | - { |
|
75 | + public function getReleaseDates() { |
|
80 | 76 | |
81 | 77 | if (empty($this->releases)) { |
82 | 78 | throw new Exception('Could not find any releases in the recording'); |
@@ -97,16 +93,14 @@ discard block |
||
97 | 93 | /** |
98 | 94 | * @return string |
99 | 95 | */ |
100 | - public function getId() |
|
101 | - { |
|
96 | + public function getId() { |
|
102 | 97 | return $this->id; |
103 | 98 | } |
104 | 99 | |
105 | 100 | /** |
106 | 101 | * @return Artist |
107 | 102 | */ |
108 | - public function getArtist() |
|
109 | - { |
|
103 | + public function getArtist() { |
|
110 | 104 | $includes = array( |
111 | 105 | 'releases', |
112 | 106 | 'recordings', |
@@ -124,8 +118,7 @@ discard block |
||
124 | 118 | * |
125 | 119 | * @return int|string |
126 | 120 | */ |
127 | - public function getLength($format = 'int') |
|
128 | - { |
|
121 | + public function getLength($format = 'int') { |
|
129 | 122 | switch ($format) { |
130 | 123 | case 'short': |
131 | 124 | return str_replace('.', ':', number_format(($this->length / 1000 / 60), 2)); |
@@ -47,8 +47,7 @@ discard block |
||
47 | 47 | /** |
48 | 48 | * @return string |
49 | 49 | */ |
50 | - public function getEntity() |
|
51 | - { |
|
50 | + public function getEntity() { |
|
52 | 51 | return 'recording'; |
53 | 52 | } |
54 | 53 | |
@@ -59,8 +58,7 @@ discard block |
||
59 | 58 | * @throws \MusicBrainz\Exception |
60 | 59 | * @return array |
61 | 60 | */ |
62 | - public function parseResponse(array $response, MusicBrainz $brainz) |
|
63 | - { |
|
61 | + public function parseResponse(array $response, MusicBrainz $brainz) { |
|
64 | 62 | $recordings = array(); |
65 | 63 | |
66 | 64 | if (isset($response['recording'])) { |
@@ -30,8 +30,7 @@ discard block |
||
30 | 30 | /** |
31 | 31 | * @param array $args |
32 | 32 | */ |
33 | - public function __construct(array $args) |
|
34 | - { |
|
33 | + public function __construct(array $args) { |
|
35 | 34 | foreach ($args as $key => $value) { |
36 | 35 | if (in_array($key, $this->validArgTypes)) { |
37 | 36 | $this->validArgs[$key] = $value; |
@@ -44,8 +43,7 @@ discard block |
||
44 | 43 | * |
45 | 44 | * @return array |
46 | 45 | */ |
47 | - public function createParameters(array $params = array()) |
|
48 | - { |
|
46 | + public function createParameters(array $params = array()) { |
|
49 | 47 | $params = $params + array('query' => ''); |
50 | 48 | |
51 | 49 | if (empty($this->validArgs) || $params['query'] != '') { |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | { |
22 | 22 | $this->client = $client; |
23 | 23 | |
24 | - if(filter_var($endpoint, FILTER_VALIDATE_URL)) { |
|
24 | + if (filter_var($endpoint, FILTER_VALIDATE_URL)) { |
|
25 | 25 | $this->endpoint = $endpoint; |
26 | 26 | } |
27 | 27 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function call($path, array $params = array(), array $options = array(), $isAuthRequired = false, $returnArray = false) |
42 | 42 | { |
43 | - if($options['user-agent'] == '') { |
|
43 | + if ($options['user-agent'] == '') { |
|
44 | 44 | throw new Exception('You must set a valid User Agent before accessing the MusicBrainz API'); |
45 | 45 | } |
46 | 46 |
@@ -17,8 +17,7 @@ discard block |
||
17 | 17 | * @param ClientInterface $client |
18 | 18 | * @param null $endpoint |
19 | 19 | */ |
20 | - public function __client(ClientInterface $client, $endpoint = null) |
|
21 | - { |
|
20 | + public function __client(ClientInterface $client, $endpoint = null) { |
|
22 | 21 | $this->client = $client; |
23 | 22 | |
24 | 23 | if(filter_var($endpoint, FILTER_VALIDATE_URL)) { |
@@ -38,8 +37,7 @@ discard block |
||
38 | 37 | * @throws Exception |
39 | 38 | * @return array |
40 | 39 | */ |
41 | - public function call($path, array $params = array(), array $options = array(), $isAuthRequired = false, $returnArray = false) |
|
42 | - { |
|
40 | + public function call($path, array $params = array(), array $options = array(), $isAuthRequired = false, $returnArray = false) { |
|
43 | 41 | if($options['user-agent'] == '') { |
44 | 42 | throw new Exception('You must set a valid User Agent before accessing the MusicBrainz API'); |
45 | 43 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * @param ClientInterface $client |
18 | 18 | * @param null $endpoint |
19 | 19 | */ |
20 | - public function __client(ClientInterface $client, $endpoint = null) |
|
20 | + public function __client(ClientInterface $client, $endpoint = NULL) |
|
21 | 21 | { |
22 | 22 | $this->client = $client; |
23 | 23 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * @throws Exception |
39 | 39 | * @return array |
40 | 40 | */ |
41 | - public function call($path, array $params = array(), array $options = array(), $isAuthRequired = false, $returnArray = false) |
|
41 | + public function call($path, array $params = array(), array $options = array(), $isAuthRequired = FALSE, $returnArray = FALSE) |
|
42 | 42 | { |
43 | 43 | if($options['user-agent'] == '') { |
44 | 44 | throw new Exception('You must set a valid User Agent before accessing the MusicBrainz API'); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | ]; |
53 | 53 | |
54 | 54 | if ($isAuthRequired) { |
55 | - if ($options['user'] != null && $options['password'] != null) { |
|
55 | + if ($options['user'] != NULL && $options['password'] != NULL) { |
|
56 | 56 | $requestOptions['auth'] = [ |
57 | 57 | 'username' => $options['user'], |
58 | 58 | 'password' => $options['password'], |
@@ -23,5 +23,5 @@ |
||
23 | 23 | * |
24 | 24 | * @return array |
25 | 25 | */ |
26 | - abstract public function call($path, array $params = array(), array $options = array(), $isAuthRequired = false, $returnArray = false); |
|
26 | + abstract public function call($path, array $params = array(), array $options = array(), $isAuthRequired = FALSE, $returnArray = FALSE); |
|
27 | 27 | } |
@@ -16,8 +16,7 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @param null $endpoint Override the default endpoint (useful for local development) |
18 | 18 | */ |
19 | - public function __construct($endpoint = null) |
|
20 | - { |
|
19 | + public function __construct($endpoint = null) { |
|
21 | 20 | if (filter_var($endpoint, FILTER_VALIDATE_URL)) { |
22 | 21 | $this->endpoint = $endpoint; |
23 | 22 | } |
@@ -35,8 +34,7 @@ discard block |
||
35 | 34 | * @throws \MusicBrainz\Exception |
36 | 35 | * @return array |
37 | 36 | */ |
38 | - public function call($path, array $params = array(), array $options = array(), $isAuthRequired = false, $returnArray = false) |
|
39 | - { |
|
37 | + public function call($path, array $params = array(), array $options = array(), $isAuthRequired = false, $returnArray = false) { |
|
40 | 38 | if ($options['user-agent'] == '') { |
41 | 39 | throw new Exception('You must set a valid User Agent before accessing the MusicBrainz API'); |
42 | 40 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @param null $endpoint Override the default endpoint (useful for local development) |
18 | 18 | */ |
19 | - public function __construct($endpoint = null) |
|
19 | + public function __construct($endpoint = NULL) |
|
20 | 20 | { |
21 | 21 | if (filter_var($endpoint, FILTER_VALIDATE_URL)) { |
22 | 22 | $this->endpoint = $endpoint; |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @throws \MusicBrainz\Exception |
36 | 36 | * @return array |
37 | 37 | */ |
38 | - public function call($path, array $params = array(), array $options = array(), $isAuthRequired = false, $returnArray = false) |
|
38 | + public function call($path, array $params = array(), array $options = array(), $isAuthRequired = FALSE, $returnArray = FALSE) |
|
39 | 39 | { |
40 | 40 | if ($options['user-agent'] == '') { |
41 | 41 | throw new Exception('You must set a valid User Agent before accessing the MusicBrainz API'); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | $requestOptions = array(); |
57 | 57 | if ($isAuthRequired) { |
58 | - if ($options['user'] != null && $options['password'] != null) { |
|
58 | + if ($options['user'] != NULL && $options['password'] != NULL) { |
|
59 | 59 | $requestOptions['auth'] = array($options['user'], $options['password']); |
60 | 60 | } else { |
61 | 61 | throw new Exception('Authentication is required'); |
@@ -23,8 +23,7 @@ discard block |
||
23 | 23 | * @param \Guzzle\Http\ClientInterface $client The Guzzle client used to make requests |
24 | 24 | * @param null $endpoint Override the default endpoint (useful for local development) |
25 | 25 | */ |
26 | - public function __construct(ClientInterface $client, $endpoint = null) |
|
27 | - { |
|
26 | + public function __construct(ClientInterface $client, $endpoint = null) { |
|
28 | 27 | $this->client = $client; |
29 | 28 | |
30 | 29 | if (filter_var($endpoint, FILTER_VALIDATE_URL)) { |
@@ -44,8 +43,7 @@ discard block |
||
44 | 43 | * @throws \MusicBrainz\Exception |
45 | 44 | * @return array |
46 | 45 | */ |
47 | - public function call($path, array $params = array(), array $options = array(), $isAuthRequired = false, $returnArray = false) |
|
48 | - { |
|
46 | + public function call($path, array $params = array(), array $options = array(), $isAuthRequired = false, $returnArray = false) { |
|
49 | 47 | if ($options['user-agent'] == '') { |
50 | 48 | throw new Exception('You must set a valid User Agent before accessing the MusicBrainz API'); |
51 | 49 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * @param \Guzzle\Http\ClientInterface $client The Guzzle client used to make requests |
24 | 24 | * @param null $endpoint Override the default endpoint (useful for local development) |
25 | 25 | */ |
26 | - public function __construct(ClientInterface $client, $endpoint = null) |
|
26 | + public function __construct(ClientInterface $client, $endpoint = NULL) |
|
27 | 27 | { |
28 | 28 | $this->client = $client; |
29 | 29 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @throws \MusicBrainz\Exception |
45 | 45 | * @return array |
46 | 46 | */ |
47 | - public function call($path, array $params = array(), array $options = array(), $isAuthRequired = false, $returnArray = false) |
|
47 | + public function call($path, array $params = array(), array $options = array(), $isAuthRequired = FALSE, $returnArray = FALSE) |
|
48 | 48 | { |
49 | 49 | if ($options['user-agent'] == '') { |
50 | 50 | throw new Exception('You must set a valid User Agent before accessing the MusicBrainz API'); |
@@ -62,14 +62,14 @@ discard block |
||
62 | 62 | $request->setHeader('User-Agent', $options['user-agent']); |
63 | 63 | |
64 | 64 | if ($isAuthRequired) { |
65 | - if ($options['user'] != null && $options['password'] != null) { |
|
65 | + if ($options['user'] != NULL && $options['password'] != NULL) { |
|
66 | 66 | $request->setAuth($options['user'], $options['password'], CURLAUTH_DIGEST); |
67 | 67 | } else { |
68 | 68 | throw new Exception('Authentication is required'); |
69 | 69 | } |
70 | 70 | } |
71 | 71 | |
72 | - $request->getQuery()->useUrlEncoding(false); |
|
72 | + $request->getQuery()->useUrlEncoding(FALSE); |
|
73 | 73 | |
74 | 74 | // musicbrainz throttle |
75 | 75 | sleep(1); |
@@ -25,8 +25,7 @@ |
||
25 | 25 | * @param array $tag |
26 | 26 | * @param MusicBrainz $brainz |
27 | 27 | */ |
28 | - public function __construct(array $tag, MusicBrainz $brainz) |
|
29 | - { |
|
28 | + public function __construct(array $tag, MusicBrainz $brainz) { |
|
30 | 29 | $this->data = $tag; |
31 | 30 | $this->brainz = $brainz; |
32 | 31 |
@@ -47,8 +47,7 @@ discard block |
||
47 | 47 | /** |
48 | 48 | * @return string |
49 | 49 | */ |
50 | - public function getEntity() |
|
51 | - { |
|
50 | + public function getEntity() { |
|
52 | 51 | return 'recording'; |
53 | 52 | } |
54 | 53 | |
@@ -59,8 +58,7 @@ discard block |
||
59 | 58 | * @throws \MusicBrainz\Exception |
60 | 59 | * @return array |
61 | 60 | */ |
62 | - public function parseResponse(array $response, MusicBrainz $brainz) |
|
63 | - { |
|
61 | + public function parseResponse(array $response, MusicBrainz $brainz) { |
|
64 | 62 | $recordings = array(); |
65 | 63 | |
66 | 64 | if (isset($response['recording'])) { |