Merge pull request #124 from phanan/analysis-XlxQdX

Applied fixes from StyleCI
This commit is contained in:
Phan An 2015-12-20 20:30:43 +08:00
commit 42c7651031
5 changed files with 11 additions and 11 deletions

View file

@ -2,10 +2,10 @@
namespace App\Http\Controllers\API; namespace App\Http\Controllers\API;
use App\Services\Lastfm;
use Illuminate\Contracts\Auth\Guard; use Illuminate\Contracts\Auth\Guard;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Routing\Redirector; use Illuminate\Routing\Redirector;
use App\Services\Lastfm;
class LastfmController extends Controller class LastfmController extends Controller
{ {

View file

@ -38,7 +38,7 @@ class Song extends Model
* *
* @return mixed * @return mixed
*/ */
public function scrobble($timestamp) public function scrobble($timestamp)
{ {
// Don't scrobble the unknown guys. No one knows them. // Don't scrobble the unknown guys. No one knows them.
if ($this->album->artist->id === Artist::UNKNOWN_ID) { if ($this->album->artist->id === Artist::UNKNOWN_ID) {
@ -53,8 +53,8 @@ class Song extends Model
} }
return Lastfm::scrobble( return Lastfm::scrobble(
$this->album->artist->name, $this->album->artist->name,
$this->title, $this->title,
$timestamp, $timestamp,
$this->album->name === Album::UNKNOWN_NAME ? '' : $this->album->name, $this->album->name === Album::UNKNOWN_NAME ? '' : $this->album->name,
$sessionKey $sessionKey

View file

@ -85,7 +85,7 @@ AuthenticatableContract,
$preferences = $this->preferences; $preferences = $this->preferences;
$preferences[$key] = $val; $preferences[$key] = $val;
$this->preferences = $preferences; $this->preferences = $preferences;
$this->save(); $this->save();
} }

View file

@ -202,7 +202,7 @@ class Lastfm extends RESTfulService
$params['method'] = 'track.scrobble'; $params['method'] = 'track.scrobble';
try { try {
return !!$this->post('/', $this->buildAuthCallParams($params), false); return (bool) $this->post('/', $this->buildAuthCallParams($params), false);
} catch (\Exception $e) { } catch (\Exception $e) {
Log::error($e); Log::error($e);

View file

@ -1,15 +1,15 @@
<?php <?php
use App\Http\Controllers\API\LastfmController;
use App\Models\User;
use App\Services\Lastfm; use App\Services\Lastfm;
use GuzzleHttp\Client; use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Response; use GuzzleHttp\Psr7\Response;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Foundation\Testing\DatabaseTransactions; use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Foundation\Testing\WithoutMiddleware; use Illuminate\Foundation\Testing\WithoutMiddleware;
use App\Models\User; use Illuminate\Http\Request;
use App\Http\Controllers\API\LastfmController;
use Illuminate\Routing\Redirector; use Illuminate\Routing\Redirector;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Http\Request;;
use Mockery as m; use Mockery as m;
class LastfmTest extends TestCase class LastfmTest extends TestCase
@ -107,7 +107,7 @@ class LastfmTest extends TestCase
'api_sig' => '7f21233b54edea994aa0f23cf55f18a2', 'api_sig' => '7f21233b54edea994aa0f23cf55f18a2',
], $api->buildAuthCallParams($params)); ], $api->buildAuthCallParams($params));
$this->assertEquals('api_key=key&bar=baz&qux=安&api_sig=7f21233b54edea994aa0f23cf55f18a2', $this->assertEquals('api_key=key&bar=baz&qux=安&api_sig=7f21233b54edea994aa0f23cf55f18a2',
$api->buildAuthCallParams($params, true)); $api->buildAuthCallParams($params, true));
} }