Merge pull request #175 from phanan/analysis-8K1oRq

Applied fixes from StyleCI
This commit is contained in:
Phan An 2016-01-03 19:34:16 +08:00
commit 4a4c253261
6 changed files with 11 additions and 11 deletions

View file

@ -3,9 +3,9 @@
namespace App\Http;
use App\Http\Middleware\Authenticate;
use App\Http\Middleware\GetUserFromToken;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
use Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode;
use App\Http\Middleware\GetUserFromToken;
class Kernel extends HttpKernel
{

View file

@ -10,13 +10,14 @@ class GetUserFromToken extends BaseMiddleware
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle($request, \Closure $next)
{
if (! $token = $this->auth->setRequest($request)->getToken()) {
if (!$token = $this->auth->setRequest($request)->getToken()) {
return $this->respond('tymon.jwt.absent', 'token_not_provided', 400);
}
@ -28,7 +29,7 @@ class GetUserFromToken extends BaseMiddleware
return $this->respond('tymon.jwt.invalid', 'token_invalid', $e->getStatusCode(), [$e]);
}
if (! $user) {
if (!$user) {
return $this->respond('tymon.jwt.user_not_found', 'user_not_found', 404);
}

View file

@ -17,7 +17,7 @@ Route::group(['prefix' => 'api', 'namespace' => 'API'], function () {
Route::post('settings', 'SettingController@save');
Route::get('{song}/play', 'SongController@play');
Route::get('{song}/play', 'SongController@play');
Route::post('{song}/scrobble/{timestamp}', 'SongController@scrobble')->where([
'timestamp' => '\d+',
]);

View file

@ -4,7 +4,6 @@ namespace App;
use Illuminate\Http\Request;
use Tymon\JWTAuth\JWTAuth as BaseJWTAuth;
use Tymon\JWTAuth\Exceptions\JWTException;
use Tymon\JWTAuth\JWTManager;
use Tymon\JWTAuth\Providers\Auth\AuthInterface;
use Tymon\JWTAuth\Providers\User\UserInterface;

View file

@ -7,7 +7,7 @@ class JWTEventListener
/**
* Handle user login events.
*/
public function onValidUser($event)
public function onValidUser($event)
{
auth()->setUser($event->user);
}
@ -15,7 +15,7 @@ class JWTEventListener
/**
* Register the listeners for the subscriber.
*
* @param Illuminate\Events\Dispatcher $events
* @param Illuminate\Events\Dispatcher $events
*/
public function subscribe($events)
{

View file

@ -161,8 +161,8 @@ return [
'storage' => function ($app) {
return new Tymon\JWTAuth\Providers\Storage\IlluminateCacheAdapter($app['cache']);
}
},
]
],
];