1 | <?php |
||
10 | abstract class BaseUrlBuilder |
||
11 | { |
||
12 | /** |
||
13 | * Gravatar endpoints. |
||
14 | */ |
||
15 | const HTTP_ENDPOINT = 'http://www.gravatar.com'; |
||
16 | const HTTPS_ENDPOINT = 'https://secure.gravatar.com'; |
||
17 | |||
18 | /** |
||
19 | * @var array |
||
20 | */ |
||
21 | protected $defaultParams = []; |
||
22 | |||
23 | /** |
||
24 | * Whether to use HTTPS endpoint. |
||
25 | * |
||
26 | * @var bool |
||
27 | */ |
||
28 | protected $secure; |
||
29 | |||
30 | /** |
||
31 | * @param array $defaultParams |
||
32 | * @param bool $secure |
||
33 | */ |
||
34 | 43 | public function __construct(array $defaultParams = [], $secure = true) |
|
39 | |||
40 | /** |
||
41 | * Creates a hash from an email address. |
||
42 | * |
||
43 | * @param string $email |
||
44 | * |
||
45 | * @return string |
||
46 | */ |
||
47 | 42 | protected function createEmailHash($email) |
|
55 | |||
56 | /** |
||
57 | * Builds the URL based on the given parameters. |
||
58 | * |
||
59 | * @param string $resource |
||
60 | * @param bool|null $secure |
||
61 | * |
||
62 | * @return string |
||
63 | */ |
||
64 | 32 | protected function buildUrl($resource, $secure = null) |
|
72 | |||
73 | /** |
||
74 | * Builds the URL based on the given parameters. |
||
75 | * |
||
76 | * @param string $resource |
||
77 | * @param array $params |
||
78 | * @param bool|null $secure |
||
79 | * |
||
80 | * @return string |
||
81 | */ |
||
82 | 11 | protected function buildUrlWithParams($resource, array $params = [], $secure = null) |
|
92 | } |
||
93 |