@@ -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 | } |
@@ -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 | } |
@@ -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 | } |
@@ -25,8 +25,7 @@ |
||
| 25 | 25 | * @param array $collection |
| 26 | 26 | * @param MusicBrainz $brainz |
| 27 | 27 | */ |
| 28 | - public function __construct(array $collection, MusicBrainz $brainz) |
|
| 29 | - { |
|
| 28 | + public function __construct(array $collection, MusicBrainz $brainz) { |
|
| 30 | 29 | $this->data = $collection; |
| 31 | 30 | $this->brainz = $brainz; |
| 32 | 31 | |
@@ -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)); |