/** * Constructor. * * @param CurlResponse $response Curl Response object. * @param LoggerInterface $logger Shared instance of a Logger. * @param string $device_id The deviceID that the message was sent to. */ public function __construct($response, $logger, $device_id) { $this->http_code = $response->http_code; $this->result = $response->get_result(); if ($response->get_network_error_number() !== 0) { $this->status = PushNotificationStatus::ERROR; $context = ['error' => $response->get_network_error_message(), 'endpoint' => $device_id]; $logger->warning('Dispatching push notification to {endpoint} failed: {error}', $context); } else { $this->set_status($device_id, $logger); } }