@@ -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 | { |
@@ -289,8 +289,7 @@ discard block |
||
| 289 | 289 | * @param string $user |
| 290 | 290 | * @param string $password |
| 291 | 291 | */ |
| 292 | - public function __construct(AbstractHttpAdapter $adapter, $user = null, $password = null) |
|
| 293 | - { |
|
| 292 | + public function __construct(AbstractHttpAdapter $adapter, $user = null, $password = null) { |
|
| 294 | 293 | $this->adapter = $adapter; |
| 295 | 294 | |
| 296 | 295 | if (null != $user) { |
@@ -314,8 +313,7 @@ discard block |
||
| 314 | 313 | * @throws Exception |
| 315 | 314 | * @return array |
| 316 | 315 | */ |
| 317 | - public function lookup($entity, $mbid, array $includes = array()) |
|
| 318 | - { |
|
| 316 | + public function lookup($entity, $mbid, array $includes = array()) { |
|
| 319 | 317 | |
| 320 | 318 | if (!$this->isValidEntity($entity)) { |
| 321 | 319 | throw new Exception('Invalid entity'); |
@@ -394,8 +392,7 @@ discard block |
||
| 394 | 392 | * @return array |
| 395 | 393 | * @throws Exception |
| 396 | 394 | */ |
| 397 | - public function browseArtist($entity, $mbid, array $includes = array(), $limit = 25, $offset = null) |
|
| 398 | - { |
|
| 395 | + public function browseArtist($entity, $mbid, array $includes = array(), $limit = 25, $offset = null) { |
|
| 399 | 396 | if (!in_array($entity, array('recording', 'release', 'release-group'))) { |
| 400 | 397 | throw new Exception('Invalid browse entity for artist'); |
| 401 | 398 | } |
@@ -413,8 +410,7 @@ discard block |
||
| 413 | 410 | * @return array |
| 414 | 411 | * @throws Exception |
| 415 | 412 | */ |
| 416 | - public function browseLabel($entity, $mbid, array $includes, $limit = 25, $offset = null) |
|
| 417 | - { |
|
| 413 | + public function browseLabel($entity, $mbid, array $includes, $limit = 25, $offset = null) { |
|
| 418 | 414 | if (!in_array($entity, array('release'))) { |
| 419 | 415 | throw new Exception('Invalid browse entity for label'); |
| 420 | 416 | } |
@@ -432,8 +428,7 @@ discard block |
||
| 432 | 428 | * @return array |
| 433 | 429 | * @throws Exception |
| 434 | 430 | */ |
| 435 | - public function browseRecording($entity, $mbid, array $includes = array(), $limit = 25, $offset = null) |
|
| 436 | - { |
|
| 431 | + public function browseRecording($entity, $mbid, array $includes = array(), $limit = 25, $offset = null) { |
|
| 437 | 432 | if (!in_array($entity, array('artist', 'release'))) { |
| 438 | 433 | throw new Exception('Invalid browse entity for recording'); |
| 439 | 434 | } |
@@ -530,8 +525,7 @@ discard block |
||
| 530 | 525 | * @throws Exception |
| 531 | 526 | * @return array |
| 532 | 527 | */ |
| 533 | - public function search(Filters\FilterInterface $filter, $limit = 25, $offset = null) |
|
| 534 | - { |
|
| 528 | + public function search(Filters\FilterInterface $filter, $limit = 25, $offset = null) { |
|
| 535 | 529 | if (count($filter->createParameters()) < 1) { |
| 536 | 530 | throw new Exception('The artist filter object needs at least 1 argument to create a query.'); |
| 537 | 531 | } |
@@ -552,8 +546,7 @@ discard block |
||
| 552 | 546 | * |
| 553 | 547 | * @return int |
| 554 | 548 | */ |
| 555 | - public function isValidMBID($mbid) |
|
| 556 | - { |
|
| 549 | + public function isValidMBID($mbid) { |
|
| 557 | 550 | return preg_match("/^(\{)?[a-f\d]{8}(-[a-f\d]{4}){4}[a-f\d]{8}(?(1)\})$/i", $mbid); |
| 558 | 551 | } |
| 559 | 552 | |
@@ -564,8 +557,7 @@ discard block |
||
| 564 | 557 | * |
| 565 | 558 | * @return bool |
| 566 | 559 | */ |
| 567 | - private function isValidEntity($entity) |
|
| 568 | - { |
|
| 560 | + private function isValidEntity($entity) { |
|
| 569 | 561 | return array_key_exists($entity, self::$validIncludes); |
| 570 | 562 | } |
| 571 | 563 | |
@@ -577,8 +569,7 @@ discard block |
||
| 577 | 569 | * |
| 578 | 570 | * @return bool |
| 579 | 571 | */ |
| 580 | - protected function isAuthRequired($entity, $includes) |
|
| 581 | - { |
|
| 572 | + protected function isAuthRequired($entity, $includes) { |
|
| 582 | 573 | if (in_array('user-tags', $includes) || in_array('user-ratings', $includes)) { |
| 583 | 574 | return true; |
| 584 | 575 | } |
@@ -597,8 +588,7 @@ discard block |
||
| 597 | 588 | * @return bool |
| 598 | 589 | * @throws \OutOfBoundsException |
| 599 | 590 | */ |
| 600 | - public function validateInclude($includes, $validIncludes) |
|
| 601 | - { |
|
| 591 | + public function validateInclude($includes, $validIncludes) { |
|
| 602 | 592 | foreach ($includes as $include) { |
| 603 | 593 | if (!in_array($include, $validIncludes)) { |
| 604 | 594 | throw new \OutOfBoundsException(sprintf('%s is not a valid include', $include)); |
@@ -615,8 +605,7 @@ discard block |
||
| 615 | 605 | * @return bool |
| 616 | 606 | * @throws Exception |
| 617 | 607 | */ |
| 618 | - public function validateFilter($values, $valid) |
|
| 619 | - { |
|
| 608 | + public function validateFilter($values, $valid) { |
|
| 620 | 609 | foreach ($values as $value) { |
| 621 | 610 | if (!in_array($value, $valid)) { |
| 622 | 611 | throw new Exception(sprintf('%s is not a valid filter', $value)); |
@@ -678,8 +667,7 @@ discard block |
||
| 678 | 667 | /** |
| 679 | 668 | * @return array |
| 680 | 669 | */ |
| 681 | - public function getHttpOptions() |
|
| 682 | - { |
|
| 670 | + public function getHttpOptions() { |
|
| 683 | 671 | return array( |
| 684 | 672 | 'method' => 'GET', |
| 685 | 673 | 'user-agent' => $this->getUserAgent(), |
@@ -693,8 +681,7 @@ discard block |
||
| 693 | 681 | * |
| 694 | 682 | * @return string |
| 695 | 683 | */ |
| 696 | - public function getUserAgent() |
|
| 697 | - { |
|
| 684 | + public function getUserAgent() { |
|
| 698 | 685 | return $this->userAgent; |
| 699 | 686 | } |
| 700 | 687 | |
@@ -707,8 +694,7 @@ discard block |
||
| 707 | 694 | * |
| 708 | 695 | * @throws Exception |
| 709 | 696 | */ |
| 710 | - public function setUserAgent($application, $version, $contactInfo) |
|
| 711 | - { |
|
| 697 | + public function setUserAgent($application, $version, $contactInfo) { |
|
| 712 | 698 | if (strpos($version, '-') !== false) { |
| 713 | 699 | throw new Exception('User agent: version should not contain a "-" character.'); |
| 714 | 700 | } |
@@ -721,8 +707,7 @@ discard block |
||
| 721 | 707 | * |
| 722 | 708 | * @return null|string |
| 723 | 709 | */ |
| 724 | - public function getUser() |
|
| 725 | - { |
|
| 710 | + public function getUser() { |
|
| 726 | 711 | return $this->user; |
| 727 | 712 | } |
| 728 | 713 | |
@@ -731,8 +716,7 @@ discard block |
||
| 731 | 716 | * |
| 732 | 717 | * @param string $user |
| 733 | 718 | */ |
| 734 | - public function setUser($user) |
|
| 735 | - { |
|
| 719 | + public function setUser($user) { |
|
| 736 | 720 | $this->user = $user; |
| 737 | 721 | } |
| 738 | 722 | |
@@ -741,8 +725,7 @@ discard block |
||
| 741 | 725 | * |
| 742 | 726 | * @return null|string |
| 743 | 727 | */ |
| 744 | - public function getPassword() |
|
| 745 | - { |
|
| 728 | + public function getPassword() { |
|
| 746 | 729 | return $this->password; |
| 747 | 730 | } |
| 748 | 731 | |
@@ -751,8 +734,7 @@ discard block |
||
| 751 | 734 | * |
| 752 | 735 | * @param string $password |
| 753 | 736 | */ |
| 754 | - public function setPassword($password) |
|
| 755 | - { |
|
| 737 | + public function setPassword($password) { |
|
| 756 | 738 | $this->password = $password; |
| 757 | 739 | } |
| 758 | 740 | } |
@@ -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 | { |
@@ -61,8 +61,7 @@ discard block |
||
| 61 | 61 | * @param array $release |
| 62 | 62 | * @param MusicBrainz $brainz |
| 63 | 63 | */ |
| 64 | - public function __construct(array $release, MusicBrainz $brainz) |
|
| 65 | - { |
|
| 64 | + public function __construct(array $release, MusicBrainz $brainz) { |
|
| 66 | 65 | $this->data = $release; |
| 67 | 66 | $this->brainz = $brainz; |
| 68 | 67 | |
@@ -80,8 +79,7 @@ discard block |
||
| 80 | 79 | /** |
| 81 | 80 | * @return string |
| 82 | 81 | */ |
| 83 | - public function getId() |
|
| 84 | - { |
|
| 82 | + public function getId() { |
|
| 85 | 83 | return $this->id; |
| 86 | 84 | } |
| 87 | 85 | |
@@ -89,8 +87,7 @@ discard block |
||
| 89 | 87 | * Get's the earliest release date |
| 90 | 88 | * @return \DateTime |
| 91 | 89 | */ |
| 92 | - public function getReleaseDate() |
|
| 93 | - { |
|
| 90 | + public function getReleaseDate() { |
|
| 94 | 91 | if (null != $this->releaseDate) { |
| 95 | 92 | return $this->releaseDate; |
| 96 | 93 | } |
@@ -110,8 +107,7 @@ discard block |
||
| 110 | 107 | * |
| 111 | 108 | * @return array |
| 112 | 109 | */ |
| 113 | - public function getReleaseEventDates(array $releaseEvents) |
|
| 114 | - { |
|
| 110 | + public function getReleaseEventDates(array $releaseEvents) { |
|
| 115 | 111 | |
| 116 | 112 | $releaseDate = new \DateTime(); |
| 117 | 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 | |
@@ -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 | } |
@@ -59,8 +59,7 @@ discard block |
||
| 59 | 59 | * |
| 60 | 60 | * @throws Exception |
| 61 | 61 | */ |
| 62 | - public function __construct(array $artist, MusicBrainz $brainz) |
|
| 63 | - { |
|
| 62 | + public function __construct(array $artist, MusicBrainz $brainz) { |
|
| 64 | 63 | if (!isset($artist['id']) || isset($artist['id']) && !$brainz->isValidMBID($artist['id'])) { |
| 65 | 64 | throw new Exception('Can not create artist object. Missing valid MBID'); |
| 66 | 65 | } |
@@ -81,32 +80,28 @@ discard block |
||
| 81 | 80 | /** |
| 82 | 81 | * @return mixed |
| 83 | 82 | */ |
| 84 | - public function getName() |
|
| 85 | - { |
|
| 83 | + public function getName() { |
|
| 86 | 84 | return $this->name; |
| 87 | 85 | } |
| 88 | 86 | |
| 89 | 87 | /** |
| 90 | 88 | * @return int |
| 91 | 89 | */ |
| 92 | - public function getScore() |
|
| 93 | - { |
|
| 90 | + public function getScore() { |
|
| 94 | 91 | return isset($this->data['score']) ? (int)$this->data['score'] : 0; |
| 95 | 92 | } |
| 96 | 93 | |
| 97 | 94 | /** |
| 98 | 95 | * @return string |
| 99 | 96 | */ |
| 100 | - public function getType() |
|
| 101 | - { |
|
| 97 | + public function getType() { |
|
| 102 | 98 | return $this->type; |
| 103 | 99 | } |
| 104 | 100 | |
| 105 | 101 | /** |
| 106 | 102 | * @return array |
| 107 | 103 | */ |
| 108 | - public function getReleases() |
|
| 109 | - { |
|
| 104 | + public function getReleases() { |
|
| 110 | 105 | if (null === $this->releases) { |
| 111 | 106 | $this->releases = $this->brainz->browseRelease('artist', $this->getId()); |
| 112 | 107 | } |
@@ -117,8 +112,7 @@ discard block |
||
| 117 | 112 | /** |
| 118 | 113 | * @return string |
| 119 | 114 | */ |
| 120 | - public function getId() |
|
| 121 | - { |
|
| 115 | + public function getId() { |
|
| 122 | 116 | return $this->id; |
| 123 | 117 | } |
| 124 | 118 | } |
@@ -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 | |
@@ -25,8 +25,7 @@ |
||
| 25 | 25 | * @throws \OutOfBoundsException |
| 26 | 26 | * @return bool |
| 27 | 27 | */ |
| 28 | - public static function getName($countryCode) |
|
| 29 | - { |
|
| 28 | + public static function getName($countryCode) { |
|
| 30 | 29 | if (!isset(self::$countries[$countryCode])) { |
| 31 | 30 | throw new \OutOfBoundsException( |
| 32 | 31 | sprintf( |
@@ -41,8 +41,7 @@ |
||
| 41 | 41 | * @param array $label |
| 42 | 42 | * @param MusicBrainz $brainz |
| 43 | 43 | */ |
| 44 | - public function __construct(array $label, MusicBrainz $brainz) |
|
| 45 | - { |
|
| 44 | + public function __construct(array $label, MusicBrainz $brainz) { |
|
| 46 | 45 | $this->data = $label; |
| 47 | 46 | $this->brainz = $brainz; |
| 48 | 47 | |
@@ -29,8 +29,7 @@ discard block |
||
| 29 | 29 | * @param array $releaseGroup |
| 30 | 30 | * @param MusicBrainz $brainz |
| 31 | 31 | */ |
| 32 | - public function __construct(array $releaseGroup, MusicBrainz $brainz) |
|
| 33 | - { |
|
| 32 | + public function __construct(array $releaseGroup, MusicBrainz $brainz) { |
|
| 34 | 33 | $this->data = $releaseGroup; |
| 35 | 34 | $this->brainz = $brainz; |
| 36 | 35 | |
@@ -40,32 +39,28 @@ discard block |
||
| 40 | 39 | /** |
| 41 | 40 | * @return string |
| 42 | 41 | */ |
| 43 | - public function getId() |
|
| 44 | - { |
|
| 42 | + public function getId() { |
|
| 45 | 43 | return $this->id; |
| 46 | 44 | } |
| 47 | 45 | |
| 48 | 46 | /** |
| 49 | 47 | * @return string |
| 50 | 48 | */ |
| 51 | - public function getTitle() |
|
| 52 | - { |
|
| 49 | + public function getTitle() { |
|
| 53 | 50 | return $this->data['title']; |
| 54 | 51 | } |
| 55 | 52 | |
| 56 | 53 | /** |
| 57 | 54 | * @return mixed |
| 58 | 55 | */ |
| 59 | - public function getScore() |
|
| 60 | - { |
|
| 56 | + public function getScore() { |
|
| 61 | 57 | return $this->data['score']; |
| 62 | 58 | } |
| 63 | 59 | |
| 64 | 60 | /** |
| 65 | 61 | * @return Release[] |
| 66 | 62 | */ |
| 67 | - public function getReleases() |
|
| 68 | - { |
|
| 63 | + public function getReleases() { |
|
| 69 | 64 | if (!empty($this->releases)) { |
| 70 | 65 | return $this->releases; |
| 71 | 66 | } |