From 2131b404f282df43a50466cde7cd50f406d8703f Mon Sep 17 00:00:00 2001 From: Antonio Carlos Ribeiro Date: Mon, 4 May 2020 18:29:57 +0000 Subject: [PATCH] Apply fixes from StyleCI [ci skip] [skip ci] --- src/Data/Repositories/Event.php | 6 +- src/Data/Repositories/SqlQuery.php | 15 ++--- src/Services/Authentication.php | 2 +- src/Support/MobileDetect.php | 10 ++-- src/Vendor/Laravel/Controllers/Stats.php | 62 ++++++++++---------- src/Vendor/Laravel/Models/Log.php | 7 ++- src/Vendor/Laravel/ServiceProvider.php | 75 ++++++++---------------- 7 files changed, 77 insertions(+), 100 deletions(-) diff --git a/src/Data/Repositories/Event.php b/src/Data/Repositories/Event.php index d32c9f71..f586eb6e 100644 --- a/src/Data/Repositories/Event.php +++ b/src/Data/Repositories/Event.php @@ -165,9 +165,9 @@ private function getEventId($event) { return $event['event'] ? $this->findOrCreate( - ['name' => $event['event']], - ['name'] - ) + ['name' => $event['event']], + ['name'] + ) : null; } diff --git a/src/Data/Repositories/SqlQuery.php b/src/Data/Repositories/SqlQuery.php index 34dd0cd7..afe18d40 100644 --- a/src/Data/Repositories/SqlQuery.php +++ b/src/Data/Repositories/SqlQuery.php @@ -38,13 +38,14 @@ class SqlQuery extends Repository */ private $config; - public function __construct($model, - SqlQueryLog $sqlQueryLogRepository, - SqlQueryBinding $sqlQueryBindingRepository, - SqlQueryBindingParameter $sqlQueryBindingParameterRepository, - Connection $connectionRepository, - Log $logRepository, - Config $config + public function __construct( + $model, + SqlQueryLog $sqlQueryLogRepository, + SqlQueryBinding $sqlQueryBindingRepository, + SqlQueryBindingParameter $sqlQueryBindingParameterRepository, + Connection $connectionRepository, + Log $logRepository, + Config $config ) { parent::__construct($model); diff --git a/src/Services/Authentication.php b/src/Services/Authentication.php index 4fe043bf..76b60b8c 100644 --- a/src/Services/Authentication.php +++ b/src/Services/Authentication.php @@ -38,7 +38,7 @@ private function executeAuthMethod($method) // Call guard() if not null if ($guard && $guard != 'null') { $auth = $auth->guard($guard); - } + } } if (is_callable([$auth, $method], true, $callable_name)) { if ($data = $auth->$method()) { diff --git a/src/Support/MobileDetect.php b/src/Support/MobileDetect.php index 06173166..1bed6d92 100644 --- a/src/Support/MobileDetect.php +++ b/src/Support/MobileDetect.php @@ -14,11 +14,11 @@ class MobileDetect extends Agent public function detectDevice() { return [ - 'kind' => $this->getDeviceKind(), - 'model' => $this->device(), - 'is_mobile' => $this->isMobile(), - 'is_robot' => $this->isRobot(), - ]; + 'kind' => $this->getDeviceKind(), + 'model' => $this->device(), + 'is_mobile' => $this->isMobile(), + 'is_robot' => $this->isRobot(), + ]; } /** diff --git a/src/Vendor/Laravel/Controllers/Stats.php b/src/Vendor/Laravel/Controllers/Stats.php index da3bc65d..d55bdf5e 100644 --- a/src/Vendor/Laravel/Controllers/Stats.php +++ b/src/Vendor/Laravel/Controllers/Stats.php @@ -106,19 +106,19 @@ public function apiLog($uuid) $query = Tracker::sessionLog($uuid, false); $query->select([ - 'id', - 'session_id', - 'method', - 'path_id', - 'query_id', - 'route_path_id', - 'is_ajax', - 'is_secure', - 'is_json', - 'wants_json', - 'error_id', - 'created_at', - ]); + 'id', + 'session_id', + 'method', + 'path_id', + 'query_id', + 'route_path_id', + 'is_ajax', + 'is_secure', + 'is_json', + 'wants_json', + 'error_id', + 'created_at', + ]); return Datatables::of($query) ->edit_column('route_name', function ($row) { @@ -203,12 +203,12 @@ public function apiErrors(Session $session) $query = Tracker::errors($session->getMinutes(), false); $query->select([ - 'id', - 'error_id', - 'session_id', - 'path_id', - 'updated_at', - ]); + 'id', + 'error_id', + 'session_id', + 'path_id', + 'updated_at', + ]); return Datatables::of($query) ->edit_column('updated_at', function ($row) { @@ -245,18 +245,18 @@ public function apiVisits(Session $session) $query = Tracker::sessions($session->getMinutes(), false); $query->select([ - 'id', - 'uuid', - 'user_id', - 'device_id', - 'agent_id', - 'client_ip', - 'referer_id', - 'cookie_id', - 'geoip_id', - 'language_id', - 'is_robot', - 'updated_at', + 'id', + 'uuid', + 'user_id', + 'device_id', + 'agent_id', + 'client_ip', + 'referer_id', + 'cookie_id', + 'geoip_id', + 'language_id', + 'is_robot', + 'updated_at', ]); return Datatables::of($query) diff --git a/src/Vendor/Laravel/Models/Log.php b/src/Vendor/Laravel/Models/Log.php index ac723070..07b84b85 100644 --- a/src/Vendor/Laravel/Models/Log.php +++ b/src/Vendor/Laravel/Models/Log.php @@ -48,8 +48,8 @@ public function routePath() public function pageViews($minutes, $results) { $query = $this->select( - $this->getConnection()->raw('DATE(created_at) as date, count(*) as total') - )->groupBy( + $this->getConnection()->raw('DATE(created_at) as date, count(*) as total') + )->groupBy( $this->getConnection()->raw('DATE(created_at)') ) ->period($minutes) @@ -67,7 +67,8 @@ public function pageViewsByCountry($minutes, $results) $query = $this ->select( - 'tracker_geoip.country_name as label', $this->getConnection()->raw('count(tracker_log.id) as value') + 'tracker_geoip.country_name as label', + $this->getConnection()->raw('count(tracker_log.id) as value') ) ->join('tracker_sessions', 'tracker_log.session_id', '=', 'tracker_sessions.id') ->join('tracker_geoip', 'tracker_sessions.geoip_id', '=', 'tracker_geoip.id') diff --git a/src/Vendor/Laravel/ServiceProvider.php b/src/Vendor/Laravel/ServiceProvider.php index 0e38be67..33e0e7a7 100644 --- a/src/Vendor/Laravel/ServiceProvider.php +++ b/src/Vendor/Laravel/ServiceProvider.php @@ -156,14 +156,14 @@ protected function registerTracker() $app['tracker.loaded'] = true; return new Tracker( - $app['tracker.config'], - $app['tracker.repositories'], - $app['request'], - $app['router'], - $app['log'], - $app, - $app['tracker.messages'] - ); + $app['tracker.config'], + $app['tracker.repositories'], + $app['request'], + $app['router'], + $app['log'], + $app, + $app['tracker.messages'] + ); }); } @@ -271,77 +271,50 @@ public function registerRepositories() $manager = new RepositoryManager( new GeoIp($this->getConfig('geoip_database_path')), - new MobileDetect(), - $uaParser, - $app['tracker.authentication'], - $app['session.store'], - $app['tracker.config'], - - new Session($sessionModel, - $app['tracker.config'], - new PhpSession()), - + new Session( + $sessionModel, + $app['tracker.config'], + new PhpSession() + ), $logRepository, - new Path($pathModel), - new Query($queryModel), - new QueryArgument($queryArgumentModel), - new Agent($agentModel), - new Device($deviceModel), - - new Cookie($cookieModel, - $app['tracker.config'], - $app['request'], - $app['cookie']), - + new Cookie( + $cookieModel, + $app['tracker.config'], + $app['request'], + $app['cookie'] + ), new Domain($domainModel), - new Referer( $refererModel, $refererSearchTermModel, $this->getAppUrl(), $app->make('PragmaRX\Tracker\Support\RefererParser') ), - $routeRepository, - new RoutePath($routePathModel), - new RoutePathParameter($routePathParameterModel), - new Error($errorModel), - new GeoIpRepository($geoipModel), - $sqlQueryRepository, - $sqlQueryBindingRepository, - $sqlQueryBindingParameterRepository, - $sqlQueryLogRepository, - $connectionRepository, - $eventRepository, - $eventLogRepository, - $systemClassRepository, - $crawlerDetect, - new Language($languageModel), - new LanguageDetect() ); @@ -434,10 +407,12 @@ protected function registerSqlQueryLogWatcher() $me = $this; if (!class_exists('Illuminate\Database\Events\QueryExecuted')) { - $this->app['events']->listen('illuminate.query', function ($query, - $bindings, - $time, - $name) use ($me) { + $this->app['events']->listen('illuminate.query', function ( + $query, + $bindings, + $time, + $name + ) use ($me) { $me->logSqlQuery($query, $bindings, $time, $name); }); } else {