@@ -6,7 +6,6 @@ |
||
| 6 | 6 | use getID3; |
| 7 | 7 | use getid3_lib; |
| 8 | 8 | use Illuminate\Support\Facades\Log; |
| 9 | -use Media; |
|
| 10 | 9 | use SplFileInfo; |
| 11 | 10 | use Symfony\Component\Finder\Finder; |
| 12 | 11 | |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | * @param array $tags The (selective) tags to sync (if the song exists) |
| 190 | 190 | * @param bool $force Whether to force syncing, even if the file is unchanged |
| 191 | 191 | * |
| 192 | - * @return bool|Song A Song object on success, |
|
| 192 | + * @return integer A Song object on success, |
|
| 193 | 193 | * true if file exists but is unmodified, |
| 194 | 194 | * or false on an error. |
| 195 | 195 | */ |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | * |
| 359 | 359 | * @throws \InvalidArgumentException |
| 360 | 360 | * |
| 361 | - * @return string|false The cover file's full path, or false if none found |
|
| 361 | + * @return string The cover file's full path, or false if none found |
|
| 362 | 362 | */ |
| 363 | 363 | private function getCoverFileUnderSameDirectory() |
| 364 | 364 | { |
@@ -31,9 +31,9 @@ |
||
| 31 | 31 | /** |
| 32 | 32 | * Set a setting (no pun) value. |
| 33 | 33 | * |
| 34 | - * @param string|array $key The key of the setting, or an associative array of settings, |
|
| 34 | + * @param string $key The key of the setting, or an associative array of settings, |
|
| 35 | 35 | * in which case $value will be discarded. |
| 36 | - * @param mixed $value |
|
| 36 | + * @param string $value |
|
| 37 | 37 | */ |
| 38 | 38 | public static function set($key, $value = null) |
| 39 | 39 | { |
@@ -250,7 +250,7 @@ |
||
| 250 | 250 | * @param string $artist Name of the artist |
| 251 | 251 | * @param string $track Name of the track |
| 252 | 252 | * @param string $album Name of the album |
| 253 | - * @param int|float $duration Duration of the track, in seconds |
|
| 253 | + * @param double $duration Duration of the track, in seconds |
|
| 254 | 254 | * @param string $sk The session key |
| 255 | 255 | * |
| 256 | 256 | * @return bool |
@@ -4,7 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | use Exception; |
| 6 | 6 | use GuzzleHttp\Client; |
| 7 | -use Illuminate\Support\Facades\Cache; |
|
| 8 | 7 | use Log; |
| 9 | 8 | |
| 10 | 9 | class Lastfm extends RESTfulService |
@@ -57,6 +57,9 @@ |
||
| 57 | 57 | */ |
| 58 | 58 | protected $secret; |
| 59 | 59 | |
| 60 | + /** |
|
| 61 | + * @param string $endpoint |
|
| 62 | + */ |
|
| 60 | 63 | public function __construct($key, $secret, $endpoint, Client $client) |
| 61 | 64 | { |
| 62 | 65 | $this->setKey($key); |
@@ -48,8 +48,8 @@ |
||
| 48 | 48 | protected function mapWebRoutes() |
| 49 | 49 | { |
| 50 | 50 | Route::middleware('web') |
| 51 | - ->namespace($this->namespace) |
|
| 52 | - ->group(base_path('routes/web.php')); |
|
| 51 | + ->namespace($this->namespace) |
|
| 52 | + ->group(base_path('routes/web.php')); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -214,7 +214,7 @@ |
||
| 214 | 214 | /** |
| 215 | 215 | * Generate a unique hash for a file path. |
| 216 | 216 | * |
| 217 | - * @param $path |
|
| 217 | + * @param string $path |
|
| 218 | 218 | * |
| 219 | 219 | * @return string |
| 220 | 220 | */ |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | * @param null|int $bitRate The target bit rate to transcode, defaults to OUTPUT_BIT_RATE. |
| 29 | 29 | * Only taken into account if $transcode is truthy. |
| 30 | 30 | * |
| 31 | - * @return RedirectResponse|Redirector |
|
| 31 | + * @return RedirectResponse|null |
|
| 32 | 32 | */ |
| 33 | 33 | public function play(Request $request, Song $song, $transcode = null, $bitRate = null) |
| 34 | 34 | { |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | - * @param App\Models\Song $song |
|
| 39 | + * @param Song $song |
|
| 40 | 40 | * |
| 41 | 41 | * @return mixed|null |
| 42 | 42 | */ |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * @param string $name |
| 61 | 61 | * @param string $artistName |
| 62 | 62 | * |
| 63 | - * @return mixed|false |
|
| 63 | + * @return false|string |
|
| 64 | 64 | */ |
| 65 | 65 | public function search(string $name, string $artistName = null) |
| 66 | 66 | { |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | /** |
| 99 | 99 | * @param JSON $response |
| 100 | 100 | * |
| 101 | - * @return string|null |
|
| 101 | + * @return string|false |
|
| 102 | 102 | */ |
| 103 | 103 | private function getLyrics($response) |
| 104 | 104 | { |
@@ -3,7 +3,6 @@ |
||
| 3 | 3 | namespace App\Services; |
| 4 | 4 | |
| 5 | 5 | use App\Models\Song; |
| 6 | -use Cache; |
|
| 7 | 6 | use GuzzleHttp\Client; |
| 8 | 7 | use Log; |
| 9 | 8 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | public function searchLyricsRelatedToSong(Song $song) |
| 44 | 44 | { |
| 45 | - if($song->hasLyrics() == false) |
|
| 45 | + if ($song->hasLyrics() == false) |
|
| 46 | 46 | { |
| 47 | 47 | if (!$song->artist->isUnknown() && !$song->artist->isVarious()) { |
| 48 | 48 | $lyrics = $this->search($song->title, $song->artist->name); |
@@ -74,11 +74,11 @@ discard block |
||
| 74 | 74 | $this->key |
| 75 | 75 | ); |
| 76 | 76 | |
| 77 | - try{ |
|
| 77 | + try { |
|
| 78 | 78 | $response = $this->jsonpDecode($this->get($uri)); |
| 79 | 79 | |
| 80 | 80 | return $this->getLyrics($response); |
| 81 | - }catch(\Exception $e){ |
|
| 81 | + } catch (\Exception $e) { |
|
| 82 | 82 | Log::error($e); |
| 83 | 83 | |
| 84 | 84 | return false; |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | private function jsonpDecode($response) |
| 94 | 94 | { |
| 95 | - return json_decode(substr(preg_replace("/[^(]*\((.*)\)/","$1",$response), 0, -1)); |
|
| 95 | + return json_decode(substr(preg_replace("/[^(]*\((.*)\)/", "$1", $response), 0, -1)); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | { |
| 105 | 105 | $lyrics = $response->message->body->lyrics->lyrics_body; |
| 106 | 106 | |
| 107 | - if(strlen($lyrics)) |
|
| 107 | + if (strlen($lyrics)) |
|
| 108 | 108 | { |
| 109 | 109 | // Correct Musixmatch spelling mistake (is for are). |
| 110 | 110 | return substr($lyrics, 0, strpos($lyrics, "******* This Lyrics is NOT for Commercial use *******")). |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | $response = $this->jsonpDecode($this->get($uri)); |
| 79 | 79 | |
| 80 | 80 | return $this->getLyrics($response); |
| 81 | - }catch(\Exception $e){ |
|
| 81 | + } catch(\Exception $e){ |
|
| 82 | 82 | Log::error($e); |
| 83 | 83 | |
| 84 | 84 | return false; |