public static function client_data(SI_Client $client) { $emails = array(); $associated_users = $client->get_associated_users(); if (!empty($associated_users)) { foreach ($associated_users as $user_id) { $user = get_userdata($user_id); if ($user) { $emails[] = $user->user_email; } } } $client_data = array('company_name' => $client->get_title(), 'address' => $client->get_address(), 'user_ids' => $associated_users, 'user_emails' => $emails, 'phone' => $client->get_phone(), 'website' => $client->get_website(), 'estimate_ids' => $client->get_invoices(), 'invoice_ids' => $client->get_estimates(), 'payment_ids' => $client->get_payments()); return $client_data; }