public function sendTo($to, Options $options = null, PayloadNotification $notification = null, PayloadData $data = null)
    {
        $response = null;

        if (is_array($to) && !empty($to)) {
            $partialTokens = array_chunk($to, self::MAX_TOKEN_PER_REQUEST, false);
            foreach ($partialTokens as $tokens) {
                $request = new Request($tokens, $options, $notification, $data);

                $responseGuzzle = $this->post($request);

                $responsePartial = new DownstreamResponse($responseGuzzle, $tokens);
                if (!$response) {
                    $response = $responsePartial;
                } else {
                    $response->merge($responsePartial);
                }
            }
        } else {
            $request = new Request($to, $options, $notification, $data);
            $responseGuzzle = $this->post($request);

            $response = new DownstreamResponse($responseGuzzle, $to);
        }

        return $response;
    }
public function sendTo($to, Options $options = null, PayloadNotification $notification = null, PayloadData $data = null)
    {
        $response = null;

        if (is_array($to) && !empty($to)) {
            $partialTokens = array_chunk($to, self::MAX_TOKEN_PER_REQUEST, false);
            foreach ($partialTokens as $tokens) {
                $request = new Request($tokens, $options, $notification, $data);

                $responseGuzzle = $this->post($request);

                $responsePartial = new DownstreamResponse($responseGuzzle, $tokens);
                if (!$response) {
                    $response = $responsePartial;
                } else {
                    $response->merge($responsePartial);
                }
            }
        } else {
            $request = new Request($to, $options, $notification, $data);
            $responseGuzzle = $this->post($request);

            $response = new DownstreamResponse($responseGuzzle, $to);
        }

        return $response;
    }
public function sendTo ( $ to , Options $ options = null , PayloadNotification $ notification = null , PayloadData $ data = null ) { $ response = null ; if ( is_array ( $ to ) && ! empty ( $ to ) ) { $ partialTokens = array_chunk ( $ to , self :: MAX_TOKEN_PER_REQUEST , false ) ; foreach ( $ partialTokens as $ tokens ) { $ request = new Request ( $ tokens , $ options , $ notification , $ data ) ; $ responseGuzzle = $ this -> post ( $ request ) ; $ responsePartial = new DownstreamResponse ( $ responseGuzzle , $ tokens ) ; if ( ! $ response ) { $ response = $ responsePartial ; } else { $ response -> merge ( $ responsePartial ) ; } } } else { $ request = new Request ( $ to , $ options , $ notification , $ data ) ; $ responseGuzzle = $ this -> post ( $ request ) ; $ response = new DownstreamResponse ( $ responseGuzzle , $ to ) ; } return $ response ; }
send a downstream message to.

- a unique device with is registration Token
- or to multiples devices with an array of registrationIds

@param string|array             $to
@param Options|null             $options
@param PayloadNotification|null $notification
@param PayloadData|null         $data

@return DownstreamResponse|null
send a downstream message to .