|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Arcanedev\Gravatar\Contracts; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* Interface Gravatar |
|
9
|
|
|
* |
|
10
|
|
|
* @author ARCANEDEV <[email protected]> |
|
11
|
|
|
*/ |
|
12
|
|
|
interface Gravatar |
|
13
|
|
|
{ |
|
14
|
|
|
/* ----------------------------------------------------------------- |
|
15
|
|
|
| Getters & Setters |
|
16
|
|
|
| ----------------------------------------------------------------- |
|
17
|
|
|
*/ |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* Get the current default image setting. |
|
21
|
|
|
* |
|
22
|
|
|
* @return string|false |
|
23
|
|
|
*/ |
|
24
|
|
|
public function getDefaultImage(); |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* Set the default image to use for avatars. |
|
28
|
|
|
* |
|
29
|
|
|
* @param string|false $image |
|
30
|
|
|
* |
|
31
|
|
|
* @return $this |
|
32
|
|
|
* |
|
33
|
|
|
* @throws \Arcanedev\Gravatar\Exceptions\InvalidImageUrlException |
|
34
|
|
|
*/ |
|
35
|
|
|
public function setDefaultImage($image); |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* Get the currently set avatar size. |
|
39
|
|
|
* |
|
40
|
|
|
* @return int |
|
41
|
|
|
*/ |
|
42
|
|
|
public function getSize(); |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* Set the avatar size to use. |
|
46
|
|
|
* |
|
47
|
|
|
* @param int $size - The avatar size to use, must be less than 512 and greater than 0. |
|
48
|
|
|
* |
|
49
|
|
|
* @return $this |
|
50
|
|
|
* |
|
51
|
|
|
* @throws \Arcanedev\Gravatar\Exceptions\InvalidImageSizeException |
|
52
|
|
|
*/ |
|
53
|
|
|
public function setSize($size); |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* Get the current maximum allowed rating for avatars. |
|
57
|
|
|
* |
|
58
|
|
|
* @return string |
|
59
|
|
|
*/ |
|
60
|
|
|
public function getRating(); |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* Set the maximum allowed rating for avatars. |
|
64
|
|
|
* |
|
65
|
|
|
* @param string $rating |
|
66
|
|
|
* |
|
67
|
|
|
* @return $this |
|
68
|
|
|
* |
|
69
|
|
|
* @throws \Arcanedev\Gravatar\Exceptions\InvalidImageRatingException |
|
70
|
|
|
*/ |
|
71
|
|
|
public function setRating($rating); |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* Check if we are using the secure protocol for the image URLs. |
|
75
|
|
|
* |
|
76
|
|
|
* @return bool |
|
77
|
|
|
*/ |
|
78
|
|
|
public function isSecured(); |
|
79
|
|
|
|
|
80
|
|
|
/* ----------------------------------------------------------------- |
|
81
|
|
|
| Main Methods |
|
82
|
|
|
| ----------------------------------------------------------------- |
|
83
|
|
|
*/ |
|
84
|
|
|
|
|
85
|
|
|
/** |
|
86
|
|
|
* Get Gravatar image source. |
|
87
|
|
|
* |
|
88
|
|
|
* @param string $email |
|
89
|
|
|
* @param int|null $size |
|
90
|
|
|
* @param string|null $rating |
|
91
|
|
|
* |
|
92
|
|
|
* @return string |
|
93
|
|
|
*/ |
|
94
|
|
|
public function src($email, $size = null, $rating = null); |
|
95
|
|
|
|
|
96
|
|
|
/** |
|
97
|
|
|
* Get the avatar URL based on the provided email address. |
|
98
|
|
|
* |
|
99
|
|
|
* @param string $email |
|
100
|
|
|
* @param bool $hash |
|
101
|
|
|
* |
|
102
|
|
|
* @return string |
|
103
|
|
|
*/ |
|
104
|
|
|
public function get($email, $hash = true); |
|
105
|
|
|
|
|
106
|
|
|
/** |
|
107
|
|
|
* Get Gravatar image tag. |
|
108
|
|
|
* |
|
109
|
|
|
* @param string $email |
|
110
|
|
|
* @param string|null $alt |
|
111
|
|
|
* @param array $attributes |
|
112
|
|
|
* @param string|null $rating |
|
113
|
|
|
* |
|
114
|
|
|
* @return \Arcanedev\Html\Elements\Img |
|
115
|
|
|
*/ |
|
116
|
|
|
public function image($email, $alt = null, array $attributes = [], $rating = null); |
|
117
|
|
|
|
|
118
|
|
|
/** |
|
119
|
|
|
* Get profile's data. |
|
120
|
|
|
* |
|
121
|
|
|
* @param string $email |
|
122
|
|
|
* @param mixed|null $default |
|
123
|
|
|
* |
|
124
|
|
|
* @return array|mixed |
|
125
|
|
|
*/ |
|
126
|
|
|
public function profile($email, $default = null); |
|
127
|
|
|
|
|
128
|
|
|
/** |
|
129
|
|
|
* Enable the use of the secure protocol for image URLs. |
|
130
|
|
|
* |
|
131
|
|
|
* @return $this |
|
132
|
|
|
*/ |
|
133
|
|
|
public function enableSecure(); |
|
134
|
|
|
|
|
135
|
|
|
/** |
|
136
|
|
|
* Disable the use of the secure protocol for image URLs. |
|
137
|
|
|
* |
|
138
|
|
|
* @return $this |
|
139
|
|
|
*/ |
|
140
|
|
|
public function disableSecure(); |
|
141
|
|
|
|
|
142
|
|
|
/** |
|
143
|
|
|
* Check if email has a gravatar. |
|
144
|
|
|
* |
|
145
|
|
|
* @param string $email |
|
146
|
|
|
* |
|
147
|
|
|
* @return bool |
|
148
|
|
|
*/ |
|
149
|
|
|
public function exists($email); |
|
150
|
|
|
|
|
151
|
|
|
/** |
|
152
|
|
|
* Get a hashed email. |
|
153
|
|
|
* |
|
154
|
|
|
* @param string $email |
|
155
|
|
|
* |
|
156
|
|
|
* @return string |
|
157
|
|
|
*/ |
|
158
|
|
|
public static function hashEmail(string $email): string; |
|
159
|
|
|
} |
|
160
|
|
|
|