Skip to content

Commit 5d8252f

Browse files
committed
psr-fixes, 0.2.2 release
1 parent 1985efb commit 5d8252f

11 files changed

+14
-13
lines changed

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ An easy-to-use API Wrapper for [Googles PageSpeed Insights](https://developers.g
1111

1212
### Simple Usage
1313
```php
14-
$uri = 'http://example.com';
14+
$url = 'http://example.com';
15+
1516
$caller = new \PhpInsights\InsightsCaller('your-google-api-key-here', 'de');
16-
$response = $caller->getResponse($uri, \PhpInsights\InsightsCaller::STRATEGY_MOBILE);
17+
$response = $caller->getResponse($url, \PhpInsights\InsightsCaller::STRATEGY_MOBILE);
1718
$result = $response->getMappedResult();
1819

1920
var_dump($result->getSpeedScore()); // 100

composer.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "dsentker/phpinsights",
33
"description": "A php wrapper for Googles page speed insights",
4+
"version": "0.2.2",
45
"require": {
56
"php": "^5.4 || ^7.0",
67
"netresearch/jsonmapper": "^1.1",

src/InsightsCaller.php

+1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ public function setCaptureScreenshot($captureScreenshot)
100100
protected function createApiEndpointUrl($url, $strategy = 'mobile')
101101
{
102102
$screenshot = ($this->isCaptureScreenshot()) ? 'true' : 'false';
103+
103104
return sprintf(self::GI_API_ENDPOINT, $url, $strategy, $this->apiKey, $this->locale, $screenshot);
104105
}
105106

src/InsightsResponse.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ private function __construct($jsonResponse)
3232
*
3333
* @throws InvalidJsonException
3434
*/
35-
public static function validateResponse($json) {
35+
public static function validateResponse($json)
36+
{
3637

3738
$result = json_decode($json);
3839

src/Result/InsightsException.php

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?php
2-
32
namespace PhpInsights\Result;
43

54
class InsightsException extends \Exception

src/Result/InsightsResult.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
class InsightsResult
99
{
10+
1011
/** @var string */
1112
private $kind;
1213

@@ -149,7 +150,7 @@ public function getUsabilityScore()
149150
{
150151
$ruleGroups = $this->getRuleGroups();
151152

152-
if(!array_key_exists(RuleGroup::GROUP_USABILITY, $ruleGroups)) {
153+
if (!array_key_exists(RuleGroup::GROUP_USABILITY, $ruleGroups)) {
153154
throw new UsabilityScoreNotAvailableException('Usability score is only available with mobile strategy API call.');
154155
}
155156

@@ -162,6 +163,7 @@ public function getUsabilityScore()
162163
public function getSpeedScore()
163164
{
164165
$ruleGroups = $this->getRuleGroups();
166+
165167
return $ruleGroups[RuleGroup::GROUP_SPEED]->getScore();
166168

167169
}
@@ -182,8 +184,8 @@ public function hasScreenshot()
182184
public function getScreenshot()
183185
{
184186

185-
if(!$this->hasScreenshot()) {
186-
ScreenshotNotAvailableException::raise();
187+
if (!$this->hasScreenshot()) {
188+
ScreenshotNotAvailableException::raise();
187189
}
188190

189191
return $this->screenshot;

src/Result/InsightsResultException.php

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?php
22
namespace PhpInsights\Result;
33

4-
54
class InsightsResultException extends \Exception
65
{
76

src/Result/Map/FormattedResults.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ public function setRuleResults($ruleResults)
5252
public function getRuleResultsByGroup($group)
5353
{
5454
$results = [];
55-
foreach($this->getRuleResults() as $rule => $ruleResult) {
56-
if(in_array($group, $ruleResult->getGroups())) {
55+
foreach ($this->getRuleResults() as $rule => $ruleResult) {
56+
if (in_array($group, $ruleResult->getGroups())) {
5757
$results[$rule] = $ruleResult;
5858
}
5959
}

src/Result/Map/Screenshot.php

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?php
22
namespace PhpInsights\Result\Map;
33

4-
54
class Screenshot
65
{
76

src/Result/ScreenshotNotAvailableException.php

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?php
22
namespace PhpInsights\Result;
33

4-
54
class ScreenshotNotAvailableException extends InsightsResultException
65
{
76

src/Result/UsabilityScoreNotAvailableException.php

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?php
22
namespace PhpInsights\Result;
33

4-
54
class UsabilityScoreNotAvailableException extends InsightsResultException
65
{
76

0 commit comments

Comments
 (0)