| 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 bool |
||
| 20 | */ |
||
| 21 | protected $useHttps; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @param bool $useHttps |
||
| 25 | */ |
||
| 26 | 25 | public function __construct($useHttps = true) |
|
| 30 | |||
| 31 | /** |
||
| 32 | * Sets the used connection endpoint. |
||
| 33 | * |
||
| 34 | * @param bool $useHttps |
||
| 35 | */ |
||
| 36 | 16 | public function useHttps($useHttps) |
|
| 40 | |||
| 41 | /** |
||
| 42 | * Creates a hash from an email address. |
||
| 43 | * |
||
| 44 | * @param string $email |
||
| 45 | * |
||
| 46 | * @return string |
||
| 47 | */ |
||
| 48 | 37 | protected function createEmailHash($email) |
|
| 56 | |||
| 57 | /** |
||
| 58 | * Builds the URL based on the given parameters. |
||
| 59 | * |
||
| 60 | * @param string $segment |
||
| 61 | * @param array $params |
||
| 62 | * @param bool|null $secure |
||
| 63 | * |
||
| 64 | * @return string |
||
| 65 | */ |
||
| 66 | 27 | protected function buildUrl($segment, array $params = [], $secure = null) |
|
| 82 | } |
||
| 83 |