original_string: protected function getAvatar(Type $type, int $size)
      {
          if (!is_int($size) || $size < 1) {
              throw new \Exception('Illegal avatar size');
          }
  
          switch (true) {
              case ($type instanceof GroupType):
                  $id = $type->id;
                  $resource = 'group';
                  break;
              case ($type instanceof AccountType):
                  $id = $type->email;
                  $resource = 'user';
                  break;
              default:
                  throw new \Exception('Unsupported type to retrieve avatar information for.');
          }
  
          $response = $this->client->get(
              $this->client->getConfig('base_uri') . '/avatars/' . $resource . '/' . $id . '/resized/' . $size . '/'
          );
  
          $json = json_decode($response->getBody());
  
          return (new AvatarType)->fromJson($json);
      }
code: protected function getAvatar(Type $type, int $size)
      {
          if (!is_int($size) || $size < 1) {
              throw new \Exception('Illegal avatar size');
          }
  
          switch (true) {
              case ($type instanceof GroupType):
                  $id = $type->id;
                  $resource = 'group';
                  break;
              case ($type instanceof AccountType):
                  $id = $type->email;
                  $resource = 'user';
                  break;
              default:
                  throw new \Exception('Unsupported type to retrieve avatar information for.');
          }
  
          $response = $this->client->get(
              $this->client->getConfig('base_uri') . '/avatars/' . $resource . '/' . $id . '/resized/' . $size . '/'
          );
  
          $json = json_decode($response->getBody());
  
          return (new AvatarType)->fromJson($json);
      }
code_tokens: protected function getAvatar ( Type $ type , int $ size ) { if ( ! is_int ( $ size ) || $ size < 1 ) { throw new \ Exception ( 'Illegal avatar size' ) ; } switch ( true ) { case ( $ type instanceof GroupType ) : $ id = $ type -> id ; $ resource = 'group' ; break ; case ( $ type instanceof AccountType ) : $ id = $ type -> email ; $ resource = 'user' ; break ; default : throw new \ Exception ( 'Unsupported type to retrieve avatar information for.' ) ; } $ response = $ this -> client -> get ( $ this -> client -> getConfig ( 'base_uri' ) . '/avatars/' . $ resource . '/' . $ id . '/resized/' . $ size . '/' ) ; $ json = json_decode ( $ response -> getBody ( ) ) ; return ( new AvatarType ) -> fromJson ( $ json ) ; }
docstring: Get avatar image
  
  @param Type|GroupType|AccountType $type Either AccountType or GroupType instance
  @param int                        $size Avatar size
  
  @return AvatarType
  @throws \Exception
docstring_tokens: Get avatar image