/*
finish request
Note: This method is not part of the PSR-7 standard.

@param mix $data
@return object
357004
public function send($data = [])
    {
        if (is_array($data)) {
            $data = json_encode($data);
        }

        $this->getBody()->write($data);

        return $this;
    }
1296365
public function appendSimpleXml($data)
    {
        $loadedXml      = simplexml_load_string($data);
        $jsonXml        = json_encode($loadedXml);
        $jsonData       = json_decode($jsonXml, true);

        $this->appendArray($jsonData);

        if ($this->_objectCreation) {
            return $this->_afterAppendDataToNewObject();
        }
        return $this;
    }
840952
public final function withParsedBody($data): ServerRequestInterface
   {
       if (null !== $data && !is_array($data) && !is_object($data)) {
           throw new InvalidArgumentException(
               "Can't get instance for parsed body: "
             . "must be null, array or object");
       }
       return $this->with("parsedBody", $this->parseParsedBody($data));
   }
471541
protected function createObjectFrom($data)
    {
        $class_name = $this->class_name;

        try {
            return new $class_name($data);
        } catch (\InvalidArgumentException $e) {
            throw new ConverterException(
                sprintf("Unable to create a '%s' instance.", $class_name),
                null,
                $e
            );
        }
    }
951711
public function data_postprocessing($data) {
        parent::data_postprocessing($data);
        // Turn off completion settings if the checkboxes aren't ticked
        if (!empty($data->completionunlocked)) {
            $autocompletion = !empty($data->completion) && $data->completion==COMPLETION_TRACKING_AUTOMATIC;
            if (empty($data->completiondiscussionsenabled) || !$autocompletion) {
                $data->completiondiscussions = 0;
            }
            if (empty($data->completionrepliesenabled) || !$autocompletion) {
                $data->completionreplies = 0;
            }
            if (empty($data->completionpostsenabled) || !$autocompletion) {
                $data->completionposts = 0;
            }
        }
    }
1136083
public function sync($data = null)
    {
        $this->insertToFlexiBee($data);
        $insertResult = $this->lastResponseCode;
        if ($insertResult == 201) {
            $this->reload();
        }
        $loadResult = $this->lastResponseCode;
        return ($insertResult + $loadResult) == 401;
    }
339716
public function createPayRequest($data)
    {
        if (empty($data['return_url']) && empty($data['cancel_url'])) {
            throw new \Exception('Return & Cancel URL should be specified');
        }

        $this->setPayRequestDetails($data);

        return $this->doPayPalRequest('Pay');
    }
532611
protected function doRequest($data)
    {
        $this->send(self::MAGIC_HEADER.pack('N', strlen($data)));
        $this->send($data);

        $data = $this->receive();

        $this->checkReceivedDataMagic($data);

        $status = unpack('Nstatus', substr($data, 4, 4))['status'];
        $data = substr($data, 12);

        if ($status != 200) {
            throw new TransportException($data ?: 'Http request failed, status: '.$status,
                TransportException::REMOTE);
        }

        return $data;
    }
868587
public function appendDataBuffer($data)
    {
        if (is_null($this->dataBuffer)) {
            $this->dataBuffer = $data;
        } else {
            $this->dataBuffer .= $data;
        }
        return $this;
    }
650750
static public function toObject($data)
    {
        if (is_object($data)) {
            return $data;
        }
        if (is_array($data)) {
            $data = json_encode($data);
        }
        return json_decode($json);
    }
1067344
public function merge($data)
    {
        foreach ($data as $key => $val) {
            if ($key === 'paths') {
                $this->addPaths((array)$val);
            } elseif ($key === 'cache') {
                $this->setCache($val);
            } else {
                $this->offsetReplace($key, $val);
            }
        }

        return $this;
    }
921049
public function toObject(array $data)
    {
        $data = json_decode(json_encode($data));

        if ($data === []) {
            $data = new \StdClass();
        }

        return $data;
    }
1330201
public function sendData($data)
    {
        $request = new LegacyNotifyRequest($this->httpClient, $this->httpRequest);
        $request->initialize($this->parameters->all());
        $request->setAlipayPublicKey($this->getAlipayPublicKey());
        $request->setVerifyNotifyId($this->verifyNotifyId);
        $request->setKey($this->getKey());
        $response = $request->send();

        $data = $response->getData();

        return $this->response = new LegacyCompletePurchaseResponse($this, $data);
    }
1025663
public function data_postprocessing($data) {
        parent::data_postprocessing($data);
        // Convert completionstatusrequired to a proper integer, if any.
        $total = 0;
        if (isset($data->completionstatusrequired) && is_array($data->completionstatusrequired)) {
            foreach (array_keys($data->completionstatusrequired) as $state) {
                $total |= $state;
            }
            $data->completionstatusrequired = $total;
        }

        if (!empty($data->completionunlocked)) {
            // Turn off completion settings if the checkboxes aren't ticked.
            $autocompletion = isset($data->completion) && $data->completion == COMPLETION_TRACKING_AUTOMATIC;

            if (!(isset($data->completionstatusrequired) && $autocompletion)) {
                $data->completionstatusrequired = null;
            }
            // Else do nothing: completionstatusrequired has been already converted
            //             into a correct integer representation.

            if (!empty($data->completionscoredisabled) || !$autocompletion) {
                $data->completionscorerequired = null;
            }
        }
    }
1027031
public function remove($data)
    {
        if (is_array($data)) {
            foreach ($data as $entity) {
                $this
                    ->manager
                    ->remove($entity);
            }
        } else {
            $this
                ->manager
                ->remove($data);
        }

        $this
            ->manager
            ->flush($data);

        return $data;
    }
1296300
public function castedUpdate($data)
    {
        foreach ($data as $k => $v) {
            $this->setCastedField($k, $v);
        }
        return $this;
    }
721073
private function createFromData($data)
    {
        $model = $this->dispense()->hydrate($data);
        $model->isNew = false;
        return $model;
    }