php – Class dedicated to transforming API response to the data I need?

I have the following code (in php) that calls the open weather api with my credentials, and returns data for me.

Know I’m returning some data I pick from that response, I’m wondering if it’s good practice to create a dedicated class for that? Is this something that’s commonly used and does it have a name?

try {
    $request = $this->http->get( '', $options);
    $response = json_decode($request->getBody());

    return (
        'main' => $response->weather(0)->main,
        'temperature' => $response->main->temp,

} catch (GuzzleException $e) {