@@ -13,18 +13,18 @@ discard block |
||
13 | 13 | |
14 | 14 | // set defaults |
15 | 15 | $releaseDate = new DateTime(); |
16 | -$artistId = null; |
|
17 | -$songId = null; |
|
16 | +$artistId = NULL; |
|
17 | +$songId = NULL; |
|
18 | 18 | $trackLen = -1; |
19 | 19 | $albumName = ''; |
20 | -$lastScore = null; |
|
20 | +$lastScore = NULL; |
|
21 | 21 | $firstRecording = array( |
22 | - 'release' => null, |
|
22 | + 'release' => NULL, |
|
23 | 23 | 'releaseDate' => new DateTime(), |
24 | - 'recording' => null, |
|
25 | - 'artistId' => null, |
|
26 | - 'recordingId' => null, |
|
27 | - 'trackLength' => null |
|
24 | + 'recording' => NULL, |
|
25 | + 'artistId' => NULL, |
|
26 | + 'recordingId' => NULL, |
|
27 | + 'trackLength' => NULL |
|
28 | 28 | ); |
29 | 29 | |
30 | 30 | // Set the search arguments to pass into the RecordingFilter |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | // if the recording has a lower score than the previous recording, stop the loop. |
45 | 45 | // This is because scores less than 100 usually don't match the search well |
46 | - if (null != $lastScore && $recording->getScore() < $lastScore) { |
|
46 | + if (NULL != $lastScore && $recording->getScore() < $lastScore) { |
|
47 | 47 | break; |
48 | 48 | } |
49 | 49 |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | $this->sortName = isset($artist['sort-name']) ? (string)$artist['sort-name'] : ''; |
75 | 75 | $this->gender = isset($artist['gender']) ? (string)$artist['gender'] : ''; |
76 | 76 | $this->country = isset($artist['country']) ? (string)$artist['country'] : ''; |
77 | - $this->beginDate = isset($artist['life-span']['begin']) ? $artist['life-span']['begin'] : null; |
|
78 | - $this->endDate = isset($artist['life-span']['ended']) ? $artist['life-span']['ended'] : null; |
|
77 | + $this->beginDate = isset($artist['life-span']['begin']) ? $artist['life-span']['begin'] : NULL; |
|
78 | + $this->endDate = isset($artist['life-span']['ended']) ? $artist['life-span']['ended'] : NULL; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function getReleases() |
109 | 109 | { |
110 | - if (null === $this->releases) { |
|
110 | + if (NULL === $this->releases) { |
|
111 | 111 | $this->releases = $this->brainz->browseRelease('artist', $this->getId()); |
112 | 112 | } |
113 | 113 |
@@ -91,7 +91,7 @@ |
||
91 | 91 | */ |
92 | 92 | public function getReleaseDate() |
93 | 93 | { |
94 | - if (null != $this->releaseDate) { |
|
94 | + if (NULL != $this->releaseDate) { |
|
95 | 95 | return $this->releaseDate; |
96 | 96 | } |
97 | 97 |
@@ -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,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,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); |
@@ -267,13 +267,13 @@ discard block |
||
267 | 267 | * |
268 | 268 | * @var string |
269 | 269 | */ |
270 | - private $user = null; |
|
270 | + private $user = NULL; |
|
271 | 271 | /** |
272 | 272 | * The password of a MusicBrainz user. Used for authentication. |
273 | 273 | * |
274 | 274 | * @var string |
275 | 275 | */ |
276 | - private $password = null; |
|
276 | + private $password = NULL; |
|
277 | 277 | /** |
278 | 278 | * The Http adapter used to make requests |
279 | 279 | * |
@@ -289,15 +289,15 @@ discard block |
||
289 | 289 | * @param string $user |
290 | 290 | * @param string $password |
291 | 291 | */ |
292 | - public function __construct(AbstractHttpAdapter $adapter, $user = null, $password = null) |
|
292 | + public function __construct(AbstractHttpAdapter $adapter, $user = NULL, $password = NULL) |
|
293 | 293 | { |
294 | 294 | $this->adapter = $adapter; |
295 | 295 | |
296 | - if (null != $user) { |
|
296 | + if (NULL != $user) { |
|
297 | 297 | $this->setUser($user); |
298 | 298 | } |
299 | 299 | |
300 | - if (null != $password) { |
|
300 | + if (NULL != $password) { |
|
301 | 301 | $this->setPassword($password); |
302 | 302 | } |
303 | 303 | } |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | $mbid, |
355 | 355 | array $includes, |
356 | 356 | $limit = 25, |
357 | - $offset = null, |
|
357 | + $offset = NULL, |
|
358 | 358 | $releaseType = array(), |
359 | 359 | $releaseStatus = array() |
360 | 360 | ) { |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | * @return array |
395 | 395 | * @throws Exception |
396 | 396 | */ |
397 | - public function browseArtist($entity, $mbid, array $includes = array(), $limit = 25, $offset = null) |
|
397 | + public function browseArtist($entity, $mbid, array $includes = array(), $limit = 25, $offset = NULL) |
|
398 | 398 | { |
399 | 399 | if (!in_array($entity, array('recording', 'release', 'release-group'))) { |
400 | 400 | throw new Exception('Invalid browse entity for artist'); |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | * @return array |
414 | 414 | * @throws Exception |
415 | 415 | */ |
416 | - public function browseLabel($entity, $mbid, array $includes, $limit = 25, $offset = null) |
|
416 | + public function browseLabel($entity, $mbid, array $includes, $limit = 25, $offset = NULL) |
|
417 | 417 | { |
418 | 418 | if (!in_array($entity, array('release'))) { |
419 | 419 | throw new Exception('Invalid browse entity for label'); |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | * @return array |
433 | 433 | * @throws Exception |
434 | 434 | */ |
435 | - public function browseRecording($entity, $mbid, array $includes = array(), $limit = 25, $offset = null) |
|
435 | + public function browseRecording($entity, $mbid, array $includes = array(), $limit = 25, $offset = NULL) |
|
436 | 436 | { |
437 | 437 | if (!in_array($entity, array('artist', 'release'))) { |
438 | 438 | throw new Exception('Invalid browse entity for recording'); |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | $mbid, |
459 | 459 | array $includes = array(), |
460 | 460 | $limit = 25, |
461 | - $offset = null, |
|
461 | + $offset = NULL, |
|
462 | 462 | $releaseType = array(), |
463 | 463 | $releaseStatus = array() |
464 | 464 | ) { |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | $entity, |
494 | 494 | $mbid, |
495 | 495 | $limit = 25, |
496 | - $offset = null, |
|
496 | + $offset = NULL, |
|
497 | 497 | array $includes, |
498 | 498 | $releaseType = array() |
499 | 499 | ) { |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | * @throws Exception |
531 | 531 | * @return array |
532 | 532 | */ |
533 | - public function search(Filters\FilterInterface $filter, $limit = 25, $offset = null) |
|
533 | + public function search(Filters\FilterInterface $filter, $limit = 25, $offset = NULL) |
|
534 | 534 | { |
535 | 535 | if (count($filter->createParameters()) < 1) { |
536 | 536 | throw new Exception('The artist filter object needs at least 1 argument to create a query.'); |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | |
543 | 543 | $params = $filter->createParameters(array('limit' => $limit, 'offset' => $offset, 'fmt' => 'json')); |
544 | 544 | |
545 | - $response = $this->adapter->call($filter->getEntity() . '/', $params, $this->getHttpOptions(), false, true); |
|
545 | + $response = $this->adapter->call($filter->getEntity() . '/', $params, $this->getHttpOptions(), FALSE, TRUE); |
|
546 | 546 | |
547 | 547 | return $filter->parseResponse($response, $this); |
548 | 548 | } |
@@ -580,14 +580,14 @@ discard block |
||
580 | 580 | protected function isAuthRequired($entity, $includes) |
581 | 581 | { |
582 | 582 | if (in_array('user-tags', $includes) || in_array('user-ratings', $includes)) { |
583 | - return true; |
|
583 | + return TRUE; |
|
584 | 584 | } |
585 | 585 | |
586 | 586 | if (substr($entity, 0, strlen('collection')) === 'collection') { |
587 | - return true; |
|
587 | + return TRUE; |
|
588 | 588 | } |
589 | 589 | |
590 | - return false; |
|
590 | + return FALSE; |
|
591 | 591 | } |
592 | 592 | |
593 | 593 | /** |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | } |
606 | 606 | } |
607 | 607 | |
608 | - return true; |
|
608 | + return TRUE; |
|
609 | 609 | } |
610 | 610 | |
611 | 611 | /** |
@@ -623,7 +623,7 @@ discard block |
||
623 | 623 | } |
624 | 624 | } |
625 | 625 | |
626 | - return true; |
|
626 | + return TRUE; |
|
627 | 627 | } |
628 | 628 | |
629 | 629 | /** |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | */ |
710 | 710 | public function setUserAgent($application, $version, $contactInfo) |
711 | 711 | { |
712 | - if (strpos($version, '-') !== false) { |
|
712 | + if (strpos($version, '-') !== FALSE) { |
|
713 | 713 | throw new Exception('User agent: version should not contain a "-" character.'); |
714 | 714 | } |
715 | 715 |