コード例 #1
0
 /**
  * Utility function used to create a new instance from a JSON string.
  *
  * @param array $json a PHP array which contains the result of a 'json_decode' execution.
  *
  * @return \Gomoob\Pushwoosh\Model\Response\CreateMessageResponse the resulting instance.
  */
 public static function create(array $json)
 {
     $createMessageResponse = new CreateMessageResponse();
     $createMessageResponse->setStatusCode($json['status_code']);
     $createMessageResponse->setStatusMessage($json['status_message']);
     // If a 'response' is provided
     if (array_key_exists('response', $json) && isset($json['response'])) {
         $createMessageResponseResponse = new CreateMessageResponseResponse();
         // If 'Messages' are provided
         if (array_key_exists('Messages', $json['response'])) {
             $createMessageResponseResponse->setMessages($json['response']['Messages']);
         }
         $createMessageResponse->setResponse($createMessageResponseResponse);
     }
     return $createMessageResponse;
 }