*/ 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:----BaPEyiRyTKojctidlxuAQMZhR8PXSxqk4Dy94cDLkOpNO85+XTeALbUZNuoDFnOisgbI2jgaKjeLvKib6lVj3DGUuRuVbmc3WW4hCpP1OWZm5fOav789sKoojpHpF07Uc+jhUmkuqiC4HRLVHbLWddSvYc+jfuyE6Ttl1cbLjezjOozSuh9hCw8JDdTvXD5XTvFFuSQ9sbYLdisuEeCqEFWnqb1/1BDcXk3/0w8vhiHZfL89yMPojKvqcvuWtyNSdQY9NPNzhHbD2Jyz/UKBODg6HUn6suszjdR6KgwYKMvsY0L8fgD/nAwAAUpR1rU/6q1IOk/PKvcVqs2xlbd2EtQrFVvhwNWabAc3sbvCqRWaZ3bpje/Io67vP0gQDgw/CUtGGeuEo4J/2rFBK81ctI0xu730nDDzxJV7lAzIdhS2U1+2f2imV05bb6Oj7dpE/+C4EX83nqM0oQp7+RYjCtPkHhR0DkCtQ8dNNS0spvjQ6ywyCVbjfUMreEdQ5ltBl/48z1cf6IumW8r24+IT/UBkAPBb1jP/OE/GA9eUI8oU6HLRvocBpEowknt2GdVeP7vyHopHQP6/NOf0QSdnCbJELoZxpHE44o34z/CixGdtEueD9bpzLFV4fAxHzUJUiwMDcxOWXv0WjdHwwo14lTiHw/UiawK9fpXKaCbsmRE=----ATTACHMENT:----MjQ1MjQ1NzY4NTAwMzc4MiA4Nzk5ODk5NzgwMDk4ODUwIDkyOTU1MDUwMzM0Nzk0NTQ=