Skip to content

Commit 36962db

Browse files
Merge pull request #3 from ARCANEDEV/patch-laravel_53
Adding Laravel 5.3 support
2 parents c740651 + 15299a2 commit 36962db

15 files changed

+50
-65
lines changed

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/.idea/
2-
/_arcanedev/
31
/build/
42
/vendor/
53
/composer.phar

.scrutinizer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ checks:
2020

2121
tools:
2222
external_code_coverage:
23-
timeout: 600
23+
timeout: 1200
2424
runs: 12
2525
php_code_sniffer:
2626
enabled: true

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ language: php
33
sudo: false
44

55
php:
6-
- 5.5.9
7-
- 5.5
86
- 5.6
97
- 7.0
8+
- 7.1
109
- nightly
1110
- hhvm
1211

@@ -18,6 +17,7 @@ env:
1817
- TESTBENCH_VERSION=3.0.*
1918
- TESTBENCH_VERSION=3.1.*
2019
- TESTBENCH_VERSION=3.2.*
20+
- TESTBENCH_VERSION=3.3.*
2121

2222
before_script:
2323
- travis_retry composer self-update

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ Feel free to check out the [releases](https://github.com/ARCANEDEV/Gravatar/rele
2020

2121
### Features
2222

23-
* Framework-agnostic (Works in any PHP projects).
24-
* Laravel 5.0, 5.1 & 5.2 are Supported.
23+
* Framework-agnostic package.
24+
* Laravel `5.0 | 5.1 | 5.2 | 5.3` are Supported.
2525
* Easy setup & configuration.
2626
* Well tested (100% code coverage with maximum code quality).
2727
* Made with :heart: & :coffee:.

_docs/0-Home.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ Feel free to check out the [releases](https://github.com/ARCANEDEV/Gravatar/rele
66

77
### Features
88

9-
* Framework-agnostic (Works in any PHP projects).
10-
* Laravel 5.0, 5.1 & 5.2 are Supported.
9+
* Framework-agnostic package.
10+
* Laravel `5.0 | 5.1 | 5.2 | 5.3` are Supported.
1111
* Easy setup & configuration.
1212
* Well tested (100% code coverage with maximum code quality).
1313
* Made with :heart: & :coffee:.

_docs/1-Requirements.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
The Gravatar package has a few system requirements:
66

7-
- PHP >= 5.5.9
7+
- PHP >= 5.6

_docs/3-Configuration.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Allowed defaults:
1616
| `wavatar` | generated faces with differing features and backgrounds. |
1717
| `retro` | awesome generated, 8-bit arcade-style pixelated faces. |
1818

19+
> **Note :** You can also specify an image URL as a default image.
20+
1921
Example images can be viewed on [the Gravatar website](https://gravatar.com/site/implement/images/).
2022

2123
### Size
@@ -33,4 +35,4 @@ By default only "g" rated images will be shown.
3335
| `r` | may contain such things as harsh profanity, intense violence, nudity, or hard drug use. |
3436
| `x` | may contain hardcore sexual imagery or extremely disturbing violence. |
3537

36-
The content rating can be changed by changing the `$rating` argument when calling `Gravatar::src` or `Gravatar::image`.
38+
The content rating can be changed by changing the `$rating` argument when calling `Gravatar::src` or `Gravatar::image`.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"type": "library",
1717
"license": "MIT",
1818
"require": {
19-
"php" : ">=5.5.9",
19+
"php" : ">=5.6",
2020
"arcanedev/support": "~3.0"
2121
},
2222
"require-dev": {

config/gravatar.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
<?php
22

3-
// For more details: https://fr.gravatar.com/site/implement/images/
3+
// For more details: https://en.gravatar.com/site/implement/images/
4+
45
return [
56
/* ------------------------------------------------------------------------------------------------
67
| Default
78
| ------------------------------------------------------------------------------------------------
8-
| The default avatar to display if we have no results.
9+
| The default avatar to display if we have no results (you can also set a default image url).
910
|
1011
| Supported:
1112
| * false

src/Gravatar.php

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public function getDefaultImage()
122122
*
123123
* @param string|false $image
124124
*
125-
* @return self
125+
* @return \Arcanedev\Gravatar\Gravatar
126126
*
127127
* @throws \Arcanedev\Gravatar\Exceptions\InvalidImageUrlException
128128
*/
@@ -131,12 +131,9 @@ public function setDefaultImage($image)
131131
if ($image !== false) {
132132
$this->cachedParams = null;
133133

134-
if (in_array(strtolower($image), $this->supportedImages)) {
135-
$image = strtolower($image);
136-
}
137-
else {
138-
$this->checkImageUrl($image);
139-
}
134+
$image = in_array(strtolower($image), $this->supportedImages)
135+
? strtolower($image)
136+
: $this->checkImageUrl($image);
140137
}
141138

142139
$this->defaultImage = $image;
@@ -159,7 +156,7 @@ public function getSize()
159156
*
160157
* @param integer $size - The avatar size to use, must be less than 512 and greater than 0.
161158
*
162-
* @return self
159+
* @return \Arcanedev\Gravatar\Gravatar
163160
*
164161
* @throws \Arcanedev\Gravatar\Exceptions\InvalidImageSizeException
165162
*/
@@ -201,7 +198,7 @@ public function getRating()
201198
*
202199
* @param string $rating
203200
*
204-
* @return self
201+
* @return \Arcanedev\Gravatar\Gravatar
205202
*
206203
* @throws \Arcanedev\Gravatar\Exceptions\InvalidImageRatingException
207204
*/
@@ -310,7 +307,7 @@ public function image($email, $alt = null, $attributes = [], $rating = null)
310307
/**
311308
* Enable the use of the secure protocol for image URLs.
312309
*
313-
* @return self
310+
* @return \Arcanedev\Gravatar\Gravatar
314311
*/
315312
public function enableSecure()
316313
{
@@ -322,7 +319,7 @@ public function enableSecure()
322319
/**
323320
* Disable the use of the secure protocol for image URLs.
324321
*
325-
* @return self
322+
* @return \Arcanedev\Gravatar\Gravatar
326323
*/
327324
public function disableSecure()
328325
{
@@ -368,6 +365,8 @@ public function hashEmail($email)
368365
*
369366
* @param string $image
370367
*
368+
* @return string
369+
*
371370
* @throws \Arcanedev\Gravatar\Exceptions\InvalidImageUrlException
372371
*/
373372
private function checkImageUrl($image)
@@ -377,6 +376,8 @@ private function checkImageUrl($image)
377376
'The default image specified is not a recognized gravatar "default" and is not a valid URL'
378377
);
379378
}
379+
380+
return $image;
380381
}
381382

382383
/* ------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)