public function Gravatar::setRating in Avatar Kit 8
Sets the maximum gravatar rating.
Parameters
string|null $rating: The rating to set, or NULL if no rating.
Return value
\Drupal\avatars_gravatar\GravatarInterface Returns the called object for chaining.
Throws
\Drupal\avatars\Exception\AvatarException Thrown if the rating is invalid.
Overrides GravatarInterface::setRating
File
- avatars_gravatar/
src/ Gravatar.php, line 153
Class
- Gravatar
- Implements the Gravatar.com API.
Namespace
Drupal\avatars_gravatarCode
public function setRating($rating = NULL) {
if (isset($rating) && !array_key_exists($rating, $this
->getRatings())) {
throw new AvatarException(sprintf('%s is an invalid rating', $rating));
}
$this->rating = $rating;
return $this;
}