public function formatMessageForPush (TypeInterface $message, $openID)
    {

        $json = [];
        $json['touser'] = $openID;
        $json['msgtype'] = $message->getType();

        $methodName = 'format' . ucfirst($message->getType()) . 'ForPush';
        if (method_exists($this, $methodName)) {
            $json[$message->getType()] = $this->$methodName($message);
        } elseif ($message instanceof Uploaded) {   
            $json[$message->getType()] = ['media_id' => $message->getMediaID()];
        }

        return $json;
    }
public function formatMessageForPush (TypeInterface $message, $openID)
    {

        $json = [];
        $json['touser'] = $openID;
        $json['msgtype'] = $message->getType();

        $methodName = 'format' . ucfirst($message->getType()) . 'ForPush';
        if (method_exists($this, $methodName)) {
            $json[$message->getType()] = $this->$methodName($message);
        } elseif ($message instanceof Uploaded) {   
            $json[$message->getType()] = ['media_id' => $message->getMediaID()];
        }

        return $json;
    }
public function formatMessageForPush ( TypeInterface $ message , $ openID ) { $ json = [ ] ; $ json [ 'touser' ] = $ openID ; $ json [ 'msgtype' ] = $ message -> getType ( ) ; $ methodName = 'format' . ucfirst ( $ message -> getType ( ) ) . 'ForPush' ; if ( method_exists ( $ this , $ methodName ) ) { $ json [ $ message -> getType ( ) ] = $ this -> $ methodName ( $ message ) ; } elseif ( $ message instanceof Uploaded ) { $ json [ $ message -> getType ( ) ] = [ 'media_id' => $ message -> getMediaID ( ) ] ; } return $ json ; }
Formats the provided message for sending as a push message to the specified recipient.

@param TypeInterface $message The message to send.
@param string        $openID  The user id of the message recipient.

@return array
Formats the provided message for sending as a push message to the specified recipient .