private function createCode (array $body)
    {
        $json = json_decode(
            $this->client->send(
                new Request(
                    'POST',
                    'https://api.weixin.qq.com/cgi-bin/qrcode/create',
                    [], 
                    json_encode($body)
                )
            )->getBody()
        );

        // Permanent QR code.
        if (in_array($body['action_name'], ['QR_LIMIT_SCENE', 'QR_LIMIT_STR_SCENE'])) {
            if (! isset($json->ticket, $json->url)) {
                throw new Exception("bad response: expected properties `ticket`, `url`");
            }

            return [$json->ticket, $json->url];
        } // Temporary QR code.
        else {
            if (! isset($json->ticket, $json->url, $json->expire_seconds)) {
                throw new Exception("bad response: expected properties `ticket`, `url`, `expire_seconds`");
            }

            return [$json->ticket, $json->url, new DateTimeImmutable('@' . (time() + $json->expire_seconds))];
        }
    }
private function createCode (array $body)
    {
        $json = json_decode(
            $this->client->send(
                new Request(
                    'POST',
                    'https://api.weixin.qq.com/cgi-bin/qrcode/create',
                    [], 
                    json_encode($body)
                )
            )->getBody()
        );

        // Permanent QR code.
        if (in_array($body['action_name'], ['QR_LIMIT_SCENE', 'QR_LIMIT_STR_SCENE'])) {
            if (! isset($json->ticket, $json->url)) {
                throw new Exception("bad response: expected properties `ticket`, `url`");
            }

            return [$json->ticket, $json->url];
        } // Temporary QR code.
        else {
            if (! isset($json->ticket, $json->url, $json->expire_seconds)) {
                throw new Exception("bad response: expected properties `ticket`, `url`, `expire_seconds`");
            }

            return [$json->ticket, $json->url, new DateTimeImmutable('@' . (time() + $json->expire_seconds))];
        }
    }
private function createCode ( array $ body ) { $ json = json_decode ( $ this -> client -> send ( new Request ( 'POST' , 'https://api.weixin.qq.com/cgi-bin/qrcode/create' , [ ] , json_encode ( $ body ) ) ) -> getBody ( ) ) ; // Permanent QR code. if ( in_array ( $ body [ 'action_name' ] , [ 'QR_LIMIT_SCENE' , 'QR_LIMIT_STR_SCENE' ] ) ) { if ( ! isset ( $ json -> ticket , $ json -> url ) ) { throw new Exception ( "bad response: expected properties `ticket`, `url`" ) ; } return [ $ json -> ticket , $ json -> url ] ; } // Temporary QR code. else { if ( ! isset ( $ json -> ticket , $ json -> url , $ json -> expire_seconds ) ) { throw new Exception ( "bad response: expected properties `ticket`, `url`, `expire_seconds`" ) ; } return [ $ json -> ticket , $ json -> url , new DateTimeImmutable ( '@' . ( time ( ) + $ json -> expire_seconds ) ) ] ; } }
Method responsible for the actual interaction with the WeChat API, and returns the arguments used for creating
a GroupService code.

@param array $body

@return array

@throws Exception
Method responsible for the actual interaction with the WeChat API and returns the arguments used for creating a GroupService code .