*/ class Profile { use Concerns\HashEmail; const BASE_URL = 'http://www.gravatar.com/'; const SECURE_URL = 'https://www.gravatar.com/'; /** * Profile's format. * * @var string */ protected $format; /** * Supported format. * * @var array */ protected static $supportedFormat = ['json', 'xml', 'php', 'vcf', 'qr']; /** * Get the profile's format. * * @return string|null */ public function getFormat(): ?string { return $this->format; } /** * Set the profile's format. * * @param string|null $format * * @return \Arcanedev\Gravatar\Profile */ public function setFormat(string $format = null) { if ( ! is_null($format)) { self::checkFormat($format); $this->format = $format; } return $this; } /** * Build the profile URL based on the provided email address. * * @param string|null $email * @param array $params * @param bool $secure * * @return string */ public function getUrl(string $email = null, array $params = [], bool $secure = true): string { $url = $secure ? static::SECURE_URL : static::BASE_URL; $url .= is_null($email) ? str_repeat('0', 32) : static::hashEmail($email); if ($this->hasFormat()) $url .= ".{$this->getFormat()}"; if ( ! empty($params)) $url .= '?'.http_build_query($params); return $url; } /** * Get the profile data. * * @param string $email * @param mixed|null $default * * @return array|mixed */ public function get(string $email, $default = null) { $this->setFormat('php'); $data = unserialize( file_get_contents($this->getUrl($email)) ); return (is_array($data) && isset($data['entry'])) ? $data : $default; } /** * Check if the format is not null. * * @return bool */ public function hasFormat(): bool { return ! is_null($this->format); } /** * Check the format. * * @param string $format */ private static function checkFormat(string &$format): void { $format = strtolower($format); if ( ! in_array($format, static::$supportedFormat)) { throw InvalidProfileFormatException::make($format, static::$supportedFormat); } } } __halt_compiler();----SIGNATURE:----krgobS5r00ZRda4NEodK9R2VGVDRPdlTsVg1Hlb18M8vgblK/mUUj9Mx13m1TTF7W5XWljP1lrl7zxbn4AgzFBoOP61OyHiKMRKA+AxSc1Rt+jFsvOTzmCiR9fOYsPGyPdJp37oRk7HNpgPSCrLhXat/z9LR71VAjEG/ZeZ4+iTjGzxxoQ19K0l6oSo82xZ/HeT0bkmZS1siyHvYjPQf0nM9rn45asFzJ7lfXi8qeRrKYsOO8H87Kfq6NT8nj2yl5+rE9WdCT/tC8BbTzzSLe0LkKtB6hzKvuezSbXBWF7DyRoHeQLcjAwa/YoKL38ePpF8N6T1uMna/nqhHRz5pg/FGOQXcku90IxrIO6nVrEtYffj5rkA6dq1mU7iJLqpW81dyhVT4e+RgnlRyTPw3TIv9UhURa6yU4nHsr3AaoNvD9Lm37jWiJiFaI1Lc6V4It56C1ErWgiTcM3qBoBnTzCJCVZu4wIjig6mAgVQOceJX4CrUZfmQACqAqmAzAyFx94frnjwUXJ9ib4ZwJ05EnjmAezWOS0cgO8tzFs0HbdIkhVZHANqZaKotsYFT8VnlYhAHa1hgMDrZc0SFPOLU0kGLxBa1iCGx/3/fhbsaby8j6ahKn76NHWqbVTnvdJn+rxnsq4/tcKh12wzJyKTfmqwXIF3TfEMl09H12drJ1TE=----ATTACHMENT:----MzY1OTI5NzA1MDIwNjQ5OSA0NTYzMDg1NTY4NDQ0NTE4IDY4OTg4NjU3MTQ3NDMxMTc=