@param array $data

@return Message
433687
public function enrichMetadata(array $data)
    {
        $metadata = $this->message->metadata()->mergeWith($data);

        return new self($this->identifier(), $this->payload(), $metadata);
    }
283961
public function create(array $data)
    {
        $data = self::mergeData($data, [
            'finished' => false,
            'smContactTaskReq' => [
                'id' => false,
            ],
        ]);

        return $this->client->doPost('contact/updateTask', $data);
    }
30090
public function data(array $data)
        {
            foreach ($data as $key => $value) {
                $this->attributes['data-'.$key] = $value;
            }
            return $this;
        }
327640
protected function formatMessage(array $data = [])
    {
        $params = array_merge($this->message, $data);

        foreach ($params as $key => $value) {
            if (in_array($key, $this->required, true) && empty($value) && empty($this->message[$key])) {
                throw new InvalidArgumentException(sprintf('Attribute "%s" can not be empty!', $key));
            }

            $params[$key] = empty($value) ? $this->message[$key] : $value;
        }

        $params['data'] = $this->formatData($params['data'] ?? []);

        return $params;
    }
368371
private function createEventFromArray(array $data = []): Event
    {
        if (null === $this->serializer) {
            $this->serializer = new PhpArraySerializer();
        }

        /** @var Event $event */
        $event = $this->serializer->deserialize($data);
        return $event;
    }
133966
public function request(array $data) {
    // Create request
    $request = Loader::request($this->config, $data);
    // Return response
    return Loader::response(
      // Execute
      $this->getHttp()->post($this->getRequestUrl(), (string) $request)->json
      // Attach request
    )->attach('request', $request);
  }
279450
public function respondWithData(array $data)
    {

        $responseData = $this->getResponseStructure(true, $data, '');
        $response = new JsonResponse($responseData, $this->getStatusCode(), $this->getHeaders());
        return $response;
    }
181479
protected function sendCustomMessage(array $data)
    {
        $result = $this->httpRaw(self::WECHAT_CUSTOM_MESSAGE_SEND_URL . 'access_token=' . $this->getAccessToken(), $data);
        return isset($result['errmsg']) && $result['errmsg'] == 'ok';
    }
72860
public function send(array $data = [])
    {
        $params = array_merge($this->message, $data);
        foreach ($params as $key => $value) {
            if (in_array($key, $this->required, true) && empty($value) && empty($this->message[$key])) {
                throw new InvalidArgumentException("Attribute '$key' can not be empty!");
            }
            $params[$key] = empty($value) ? $this->message[$key] : $value;
        }
        $params['data'] = $this->formatData($params['data']);
        $this->message = $this->messageBackup;
        return $this->json(static::API_SEND_NOTICE, $params);
    }
1007989
protected function createReceiveShortVideoMsg(array $data)
    {
        $result = new WxReceiveShortVideoMsg();
        $this->initReceiveMsg($result, $data);
        $result->setMediaId(isset($data['MediaId']) ? trim($data['MediaId']) : '');
        $result->setThumbMediaId(isset($data['ThumbMediaId']) ? trim($data['ThumbMediaId']) : '');
        return $result;
    }
85259
protected function createReceiveVoiceMsg(array $data)
    {
        $result = new WxReceiveVoiceMsg();
        $this->initReceiveMsg($result, $data);
        $result->setMediaId(isset($data['MediaId']) ? trim($data['MediaId']) : '');
        $result->setFormat(isset($data['Format']) ? trim($data['Format']) : '');
        return $result;
    }
221633
public function check($data)
	{
		$failure  = 0;
		$messages = array();

		if (is_string($data))
		{
			$data = array('text' => $data);
		}

		$data = $this->prepareData($data);

		foreach ($this->detectors as $id => $detector)
		{
			$spam = false;
			$msg  = null;

			try
			{
				if ($detector->detect($data))
				{
					$spam = true;

					if ($detector->message())
					{
						$messages[] = $detector->message();
					}

					$failure++;
				}

				$msg = $detector->message();
			}
			catch (Exception $e)
			{
				$this->setError($e->getMessage());
			}

			$this->mark($id, $spam, $msg);
		}

		$result = new Result($failure > 0, $messages);

		return $result;
	}
1040810
public function sendMessage(array $data)
    {
        $result = $this->httpRaw(self::WECHAT_MESSAGE_SEND_PREFIX, $data, [
            'access_token' => $this->getAccessToken()
        ]);
        return isset($result['errmsg']) && $result['errmsg'] == 'ok' ? $result : $this->dump([self::WECHAT_BASE_URL . self::WECHAT_MESSAGE_SEND_PREFIX, $this->getAccessToken(), $data, $result]);
    }
1125366
public static function fromData(array $data)
    {
        $reflection = new \ReflectionClass(static::class);
        $instance = $reflection->newInstanceWithoutConstructor();
        $instance->data = $data;
        $instance->jsonUnserialize($data);
        return $instance;
    }
74070
public function send(array $data)
    {
        $text = self::sanitizeText($data['text']);
        $to   = preg_replace("/[(,),\-,\s]/", "", $data['to']);
        $from = preg_replace("/[(,),\-,\s]/", "", $data['from']);

        $this->client->messages->create($to, ['from' => $from, 'body' => $text]);

        return true;
    }
588413
public static function fromArray($data)
    {
        $email = new SimpleSMS();

        foreach ($data["recipients"] as $recipient) {
            $email->addRecipientByNumber($recipient["number"], $recipient["name"]);
        }

        $email->setText($data["text"]);

        return $email;
    }
787581
public static function fromArray(array $data): self
    {
        if (!array_key_exists('token', $data)) {
            throw new InvalidArgumentException('Missing field "token"');
        }

        $message = self::create($data['token']);

        if ($data['data'] ?? null) {
            $message = $message->withData($data['data']);
        }

        if ($data['notification'] ?? null) {
            $message = $message->withNotification(Notification::fromArray($data['notification']));
        }

        if ($data['android'] ?? null) {
            $message = $message->withAndroidConfig(AndroidConfig::fromArray($data['android']));
        }

        if ($data['apns'] ?? null) {
            $message = $message->withApnsConfig(ApnsConfig::fromArray($data['apns']));
        }

        if ($data['webpush'] ?? null) {
            $message = $message->withWebPushConfig(WebPushConfig::fromArray($data['webpush']));
        }

        return $message;
    }