@@ -442,8 +442,8 @@ discard block |
||
442 | 442 | } |
443 | 443 | |
444 | 444 | /** |
445 | - * @param $entity |
|
446 | - * @param $mbid |
|
445 | + * @param string $entity |
|
446 | + * @param string $mbid |
|
447 | 447 | * @param array $includes |
448 | 448 | * @param int $limit |
449 | 449 | * @param null $offset |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | /** |
561 | 561 | * Check the list of allowed entities |
562 | 562 | * |
563 | - * @param $entity |
|
563 | + * @param string $entity |
|
564 | 564 | * |
565 | 565 | * @return bool |
566 | 566 | */ |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | /** |
573 | 573 | * Some calls require authentication |
574 | 574 | * |
575 | - * @param $entity |
|
575 | + * @param string $entity |
|
576 | 576 | * @param $includes |
577 | 577 | * |
578 | 578 | * @return bool |
@@ -719,7 +719,7 @@ discard block |
||
719 | 719 | /** |
720 | 720 | * Returns the MusicBrainz user |
721 | 721 | * |
722 | - * @return null|string |
|
722 | + * @return string |
|
723 | 723 | */ |
724 | 724 | public function getUser() |
725 | 725 | { |
@@ -739,7 +739,7 @@ discard block |
||
739 | 739 | /** |
740 | 740 | * Returns the user’s password |
741 | 741 | * |
742 | - * @return null|string |
|
742 | + * @return string |
|
743 | 743 | */ |
744 | 744 | public function getPassword() |
745 | 745 | { |
@@ -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 |
@@ -108,7 +108,7 @@ |
||
108 | 108 | /** |
109 | 109 | * @param array $releaseEvents |
110 | 110 | * |
111 | - * @return array |
|
111 | + * @return \DateTime |
|
112 | 112 | */ |
113 | 113 | public function getReleaseEventDates(array $releaseEvents) |
114 | 114 | { |
@@ -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 |
@@ -67,6 +67,7 @@ |
||
67 | 67 | } |
68 | 68 | |
69 | 69 | var_dump(array($firstRecording)); |
70 | -} catch (Exception $e) { |
|
70 | +} |
|
71 | +catch (Exception $e) { |
|
71 | 72 | print ($e->getMessage()); |
72 | 73 | } |
@@ -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 |
@@ -24,7 +24,8 @@ discard block |
||
24 | 24 | try { |
25 | 25 | $releaseGroups = $brainz->search(new ReleaseGroupFilter($args)); |
26 | 26 | var_dump($releaseGroups); |
27 | -} catch (Exception $e) { |
|
27 | +} |
|
28 | +catch (Exception $e) { |
|
28 | 29 | print $e->getMessage(); |
29 | 30 | } |
30 | 31 | print "\n\n"; |
@@ -41,7 +42,8 @@ discard block |
||
41 | 42 | try { |
42 | 43 | $artists = $brainz->search(new ArtistFilter($args)); |
43 | 44 | print_r($artists); |
44 | -} catch (Exception $e) { |
|
45 | +} |
|
46 | +catch (Exception $e) { |
|
45 | 47 | print $e->getMessage(); |
46 | 48 | } |
47 | 49 | print "\n\n"; |
@@ -59,7 +61,8 @@ discard block |
||
59 | 61 | try { |
60 | 62 | $recordings = $brainz->search(new RecordingFilter($args)); |
61 | 63 | print_r($recordings); |
62 | -} catch (Exception $e) { |
|
64 | +} |
|
65 | +catch (Exception $e) { |
|
63 | 66 | print $e->getMessage(); |
64 | 67 | } |
65 | 68 | print "\n\n"; |
@@ -75,6 +78,7 @@ discard block |
||
75 | 78 | try { |
76 | 79 | $labels = $brainz->search(new LabelFilter($args)); |
77 | 80 | print_r($labels); |
78 | -} catch (Exception $e) { |
|
81 | +} |
|
82 | +catch (Exception $e) { |
|
79 | 83 | print $e->getMessage(); |
80 | 84 | } |
@@ -24,7 +24,8 @@ discard block |
||
24 | 24 | try { |
25 | 25 | $artist = $brainz->lookup('artist', '4dbf5678-7a31-406a-abbe-232f8ac2cd63', $includes); |
26 | 26 | print_r($artist); |
27 | -} catch (Exception $e) { |
|
27 | +} |
|
28 | +catch (Exception $e) { |
|
28 | 29 | print $e->getMessage(); |
29 | 30 | } |
30 | 31 | print "\n\n"; |
@@ -38,6 +39,7 @@ discard block |
||
38 | 39 | //born this way: the remix |
39 | 40 | $releaseGroup = $brainz->lookup('release-group', 'e4307c5f-1959-4163-b4b1-ded4f9d786b0'); |
40 | 41 | print_r($releaseGroup); |
41 | -} catch (Exception $e) { |
|
42 | +} |
|
43 | +catch (Exception $e) { |
|
42 | 44 | echo $e->getMessage(); |
43 | 45 | } |
@@ -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 |
@@ -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,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'); |