/**
  * @param string $email
  * @param int    $size
  * @param bool   $secure
  *
  * @throws \Twig_Error_Runtime
  * @return string
  */
 public function getGravatarForUser($email, $size = 58, $secure = false)
 {
     if (!$this->userService instanceof GravatarProvider) {
         throw new \Twig_Error_Runtime('Given user service is not able to provide Gravatar link');
     }
     return $this->userService->getGravatarLink($email, $size, $secure);
 }
 /**
  * @param array $users
  * @param $type
  * @return array
  */
 protected function convertUsers(array $users, $type)
 {
     $result = array();
     foreach ($users as $user) {
         $converted = array();
         foreach ($this->properties as $property) {
             $converted[$property] = $this->getPropertyValue($property, $user);
         }
         $converted['type'] = $type;
         if (is_array($user)) {
             $converted[self::ID_FIELD_NAME] = $type . User::DELIMITER . $user[self::ID_FIELD_NAME];
         } else {
             $converted[self::ID_FIELD_NAME] = $type . User::DELIMITER . $user->getId();
         }
         if ($type === User::TYPE_DIAMANTE) {
             $converted['avatar'] = $this->userService->getGravatarLink($converted['email'], self::AVATAR_SIZE);
             $converted['type_label'] = 'customer';
         } else {
             $converted['avatar'] = $this->getPropertyValue('avatar', $user);
             $converted['type_label'] = 'admin';
         }
         $result[] = $converted;
     }
     return $result;
 }