src/Encoder/PayloadEncoder.php
private function convertAlertToArray(Alert $alert): array
    {
        $data = [];

        if ($alert->getBodyLocalized()->getKey()) {
            $data['loc-key'] = $alert->getBodyLocalized()->getKey();
            $data['loc-args'] = $alert->getBodyLocalized()->getArgs();
        } else {
            $data['body'] = $alert->getBody();
        }

        if ($alert->getTitleLocalized()->getKey()) {
            $data['title-loc-key'] = $alert->getTitleLocalized()->getKey();
            $data['title-loc-args'] = $alert->getTitleLocalized()->getArgs();
        } elseif ($alert->getTitle()) {
            $data['title'] = $alert->getTitle();
        }

        if ($alert->getActionLocalized()->getKey()) {
            $data['action-loc-key'] = $alert->getActionLocalized()->getKey();
        }

        if ($alert->getLaunchImage()) {
            $data['launch-image'] = $alert->getLaunchImage();
        }

        return $data;
    }
private function convertAlertToArray(Alert $alert): array
    {
        $data = [];

        if ($alert->getBodyLocalized()->getKey()) {
            $data['loc-key'] = $alert->getBodyLocalized()->getKey();
            $data['loc-args'] = $alert->getBodyLocalized()->getArgs();
        } else {
            $data['body'] = $alert->getBody();
        }

        if ($alert->getTitleLocalized()->getKey()) {
            $data['title-loc-key'] = $alert->getTitleLocalized()->getKey();
            $data['title-loc-args'] = $alert->getTitleLocalized()->getArgs();
        } elseif ($alert->getTitle()) {
            $data['title'] = $alert->getTitle();
        }

        if ($alert->getActionLocalized()->getKey()) {
            $data['action-loc-key'] = $alert->getActionLocalized()->getKey();
        }

        if ($alert->getLaunchImage()) {
            $data['launch-image'] = $alert->getLaunchImage();
        }

        return $data;
    }
Convert alert object to array

@param Alert $alert

@return array