Skip to content

Commit

Permalink
Merge pull request #492 from antonioribeiro/analysis-AD3QRy
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI

[ci skip] [skip ci]
  • Loading branch information
antonioribeiro authored May 4, 2020
2 parents f185382 + 2131b40 commit 8118a70
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 100 deletions.
6 changes: 3 additions & 3 deletions src/Data/Repositories/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ private function getEventId($event)
{
return $event['event']
? $this->findOrCreate(
['name' => $event['event']],
['name']
)
['name' => $event['event']],
['name']
)
: null;
}

Expand Down
15 changes: 8 additions & 7 deletions src/Data/Repositories/SqlQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion src/Services/Authentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
10 changes: 5 additions & 5 deletions src/Support/MobileDetect.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
];
}

/**
Expand Down
62 changes: 31 additions & 31 deletions src/Vendor/Laravel/Controllers/Stats.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
Expand Down
7 changes: 4 additions & 3 deletions src/Vendor/Laravel/Models/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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')
Expand Down
75 changes: 25 additions & 50 deletions src/Vendor/Laravel/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']
);
});
}

Expand Down Expand Up @@ -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()
);

Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 8118a70

Please sign in to comment.