WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 21fd735

Browse files
committed
psr2
1 parent 2a52349 commit 21fd735

File tree

5 files changed

+22
-14
lines changed

5 files changed

+22
-14
lines changed

src/GoogleApiHelper.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php namespace Spatie\LaravelAnalytics;
1+
<?php
2+
3+
namespace Spatie\LaravelAnalytics;
24

35
use Carbon\Carbon;
46
use Exception;
@@ -81,7 +83,7 @@ public function performRealTimeQuery($id, $metrics, array $others = [])
8183
return $this->cache->get($realTimeCacheName);
8284
}
8385

84-
$googleAnswer = $this->service->data_realtime->get($id, $metrics, $others);
86+
$googleAnswer = $this->service->data_realtime->get($id, $metrics, $others);
8587

8688
if ($this->useRealTimeCache()) {
8789
$this->cache->put($realTimeCacheName, $googleAnswer, Carbon::now()->addSeconds($this->realTimeCacheLifeTimeInSeconds));
@@ -107,7 +109,7 @@ public function getSiteIdByUrl($url)
107109
return $siteIds[$url];
108110
}
109111

110-
throw new Exception("Site ".$url." is not present in your Analytics account.");
112+
throw new Exception('Site '.$url.' is not present in your Analytics account.');
111113
}
112114

113115
/**
@@ -119,11 +121,11 @@ public function getAllSiteIds()
119121
{
120122
static $siteIds = null;
121123

122-
if (! is_null($siteIds)) {
124+
if (!is_null($siteIds)) {
123125
return $siteIds;
124126
}
125127

126-
foreach ($this->service->management_profiles->listManagementProfiles("~all", "~all") as $site) {
128+
foreach ($this->service->management_profiles->listManagementProfiles('~all', '~all') as $site) {
127129
$siteIds[$site['websiteUrl']] = 'ga:'.$site['id'];
128130
}
129131

src/LaravelAnalytics.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php namespace Spatie\LaravelAnalytics;
1+
<?php
2+
3+
namespace Spatie\LaravelAnalytics;
24

35
use Carbon\Carbon;
46
use DateTime;

src/LaravelAnalyticsFacade.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php namespace Spatie\LaravelAnalytics;
1+
<?php
2+
3+
namespace Spatie\LaravelAnalytics;
24

35
use Illuminate\Support\Facades\Facade;
46

src/LaravelAnalyticsServiceProvider.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php namespace Spatie\LaravelAnalytics;
1+
<?php
2+
3+
namespace Spatie\LaravelAnalytics;
24

35
use Illuminate\Support\ServiceProvider;
46
use Google_Client;
@@ -12,7 +14,7 @@ class LaravelAnalyticsServiceProvider extends ServiceProvider
1214
public function boot()
1315
{
1416
$this->publishes([
15-
__DIR__.'/config/laravel-analytics.php' => config_path('laravel-analytics.php'),
17+
__DIR__.'/config/laravel-analytics.php' => config_path('laravel-analytics.php'),
1618
]);
1719
}
1820

tests/LaravelAnalyticsTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function testGetVisitorsAndPageViews()
2626

2727
$this->client
2828
->shouldReceive('performQuery')
29-
->with($this->siteId, $startDate, $endDate, "ga:visits,ga:pageviews", ['dimensions' => 'ga:date'])
29+
->with($this->siteId, $startDate, $endDate, 'ga:visits,ga:pageviews', ['dimensions' => 'ga:date'])
3030
->andReturn((object) ['rows' => [['20140101', 2, 3]]]);
3131

3232
$googleResult = $this->laravelAnalytics->getVisitorsAndPageViews();
@@ -50,7 +50,7 @@ public function testGetTopKeywords()
5050

5151
$this->client
5252
->shouldReceive('performQuery')
53-
->with($this->siteId, $startDate, $endDate, "ga:sessions", ['dimensions' => 'ga:keyword', 'sort' => '-ga:sessions', 'max-results' => 30, 'filters' => 'ga:keyword!=(not set);ga:keyword!=(not provided)'])
53+
->with($this->siteId, $startDate, $endDate, 'ga:sessions', ['dimensions' => 'ga:keyword', 'sort' => '-ga:sessions', 'max-results' => 30, 'filters' => 'ga:keyword!=(not set);ga:keyword!=(not provided)'])
5454
->andReturn((object) ['rows' => [['first', 'second']]]);
5555

5656
$googleResult = $this->laravelAnalytics->getTopKeyWords();
@@ -68,7 +68,7 @@ public function testGetTopReferrers()
6868

6969
$this->client
7070
->shouldReceive('performQuery')
71-
->with($this->siteId, $startDate, $endDate, "ga:pageviews", ['dimensions' => 'ga:fullReferrer', 'sort' => '-ga:pageviews', 'max-results' => 20])
71+
->with($this->siteId, $startDate, $endDate, 'ga:pageviews', ['dimensions' => 'ga:fullReferrer', 'sort' => '-ga:pageviews', 'max-results' => 20])
7272
->andReturn((object) ['rows' => [['foundUrl', '123']]]);
7373

7474
$googleResult = $this->laravelAnalytics->getTopReferrers();
@@ -86,7 +86,7 @@ public function testGetTopBrowsers()
8686

8787
$this->client
8888
->shouldReceive('performQuery')
89-
->with($this->siteId, $startDate, $endDate, "ga:sessions", ['dimensions' => 'ga:browser', 'sort' => '-ga:sessions'])
89+
->with($this->siteId, $startDate, $endDate, 'ga:sessions', ['dimensions' => 'ga:browser', 'sort' => '-ga:sessions'])
9090
->andReturn((object) ['rows' => [['Google Chrome', '123']]]);
9191

9292
$googleResult = $this->laravelAnalytics->getTopBrowsers();
@@ -104,7 +104,7 @@ public function testGetMostVisitedPages()
104104

105105
$this->client
106106
->shouldReceive('performQuery')
107-
->with($this->siteId, $startDate, $endDate, "ga:pageviews", ['dimensions' => 'ga:pagePath', 'sort' => '-ga:pageviews', 'max-results' => 20])
107+
->with($this->siteId, $startDate, $endDate, 'ga:pageviews', ['dimensions' => 'ga:pagePath', 'sort' => '-ga:pageviews', 'max-results' => 20])
108108
->andReturn((object) ['rows' => [['visited url', '123']]]);
109109

110110
$googleResult = $this->laravelAnalytics->getMostVisitedPages();

0 commit comments

Comments
 (0)