@param $response
@param string $indexAttribute
@param array $postAttributes

@return array
338179
protected function parsePublishPost($response, $indexAttribute = null, $postAttributes = []) {
		if (ArrayHelper::getValue($response, $indexAttribute)) {
			$time_created = ArrayHelper::getValue($response, $postAttributes['time_created']);

			return [
				'service_id_author' => ArrayHelper::getValue($response, $postAttributes['service_id_author']),
				'service_id_post' => ArrayHelper::getValue($response, $postAttributes['service_id_post']),
				'time_created' => is_integer($time_created) ? $time_created : strtotime($time_created),
			];
		} else {
			return [];
		}

	}
628317
private function prepareContent($postArray) {
		$returnArray = [];

		/**
		 * function used to concatenate two arrays key by key
		 * @param 	String		$item1		value from the first array
		 * @param 	String		$item2		value from the second array
		 * @return	String
		 */
		function combine($item1, $item2) {
			return $item1.$item2;
		}

		unset($postArray['_token']);

		foreach ($postArray as $key => $item) {
			$keys = explode('__', $key);

			if (is_array($item)) {
				if (isset($item['before'])) {
					$value = $this->sanitize(implode('|', array_map(function($item1, $item2) {return $item1.$item2;}, str_replace('|', '&#124;', $item['before']), str_replace('|', '&#124;',$item['after']))));
				} else {
					$value = $this->sanitize(implode('|', str_replace('|', '&#124;', $item['after'])));
				}
			} else {
				$value = $this->sanitize(str_replace('|', '&#124;',$item));
			}

			$this->setArrayValue($returnArray, $keys, $value);
		}

		return $returnArray;
	}
599566
function http($url, $method, $postfields = NULL) {
    $this->http_info = array();
    $ci = curl_init();
    /* Curl settings */
    curl_setopt($ci, CURLOPT_USERAGENT, $this->useragent);
    curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, $this->connecttimeout);
    curl_setopt($ci, CURLOPT_TIMEOUT, $this->timeout);
    curl_setopt($ci, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ci, CURLOPT_HTTPHEADER, array('Expect:'));
    curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, $this->ssl_verifypeer);
    curl_setopt($ci, CURLOPT_HEADERFUNCTION, array($this, 'getHeader'));
    curl_setopt($ci, CURLOPT_HEADER, FALSE);

    switch ($method) {
      case 'POST':
        curl_setopt($ci, CURLOPT_POST, TRUE);
        if (!empty($postfields)) {
          curl_setopt($ci, CURLOPT_POSTFIELDS, $postfields);
        }
        break;
      case 'DELETE':
        curl_setopt($ci, CURLOPT_CUSTOMREQUEST, 'DELETE');
        if (!empty($postfields)) {
          $url = "{$url}?{$postfields}";
        }
    }

    curl_setopt($ci, CURLOPT_URL, $url);
    $response = curl_exec($ci);
    $this->http_code = curl_getinfo($ci, CURLINFO_HTTP_CODE);
    $this->http_info = array_merge($this->http_info, curl_getinfo($ci));
    $this->url = $url;
    curl_close ($ci);
    return $response;
  }
734765
public function requestServerData($uri, $postData = [])
    {
        $result = Http::post($this->createServerUrl($uri), function ($http) use ($postData) {
            $this->applyHttpAttributes($http, $postData);
        });

        if ($result->code == 404) {
            throw new ApplicationException(Lang::get('system::lang.server.response_not_found'));
        }

        if ($result->code != 200) {
            throw new ApplicationException(
                strlen($result->body)
                ? $result->body
                : Lang::get('system::lang.server.response_empty')
            );
        }

        $resultData = false;

        try {
            $resultData = @json_decode($result->body, true);
        }
        catch (Exception $ex) {
            throw new ApplicationException(Lang::get('system::lang.server.response_invalid'));
        }

        if ($resultData === false || (is_string($resultData) && !strlen($resultData))) {
            throw new ApplicationException(Lang::get('system::lang.server.response_invalid'));
        }

        return $resultData;
    }
111370
function http($url, $method, $postfields = NULL, $headers = array()) {
        $this->http_info = array();
        $ci = curl_init();
        /* Curl settings */
        curl_setopt($ci, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
        curl_setopt($ci, CURLOPT_USERAGENT, $this->useragent);
        curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, $this->connecttimeout);
        curl_setopt($ci, CURLOPT_TIMEOUT, $this->timeout);
        curl_setopt($ci, CURLOPT_RETURNTRANSFER, TRUE);
        curl_setopt($ci, CURLOPT_ENCODING, "");
        curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, $this->ssl_verifypeer);
        if (version_compare(phpversion(), '5.4.0', '<')) {
            curl_setopt($ci, CURLOPT_SSL_VERIFYHOST, 1);
        } else {
            curl_setopt($ci, CURLOPT_SSL_VERIFYHOST, 2);
        }
        curl_setopt($ci, CURLOPT_HEADERFUNCTION, array($this, 'getHeader'));
        curl_setopt($ci, CURLOPT_HEADER, FALSE);

        switch ($method) {
            case 'POST':
                curl_setopt($ci, CURLOPT_POST, TRUE);
                if (!empty($postfields)) {
                    curl_setopt($ci, CURLOPT_POSTFIELDS, $postfields);
                    $this->postdata = $postfields;
                }
                break;
            case 'DELETE':
                curl_setopt($ci, CURLOPT_CUSTOMREQUEST, 'DELETE');
                if (!empty($postfields)) {
                    $url = "{$url}?{$postfields}";
                }
        }

        curl_setopt($ci, CURLOPT_URL, $url );
        curl_setopt($ci, CURLOPT_HTTPHEADER, $headers );
        curl_setopt($ci, CURLINFO_HEADER_OUT, TRUE );

        $response = curl_exec($ci);
        $this->http_code = curl_getinfo($ci, CURLINFO_HTTP_CODE);
        $this->http_info = array_merge($this->http_info, curl_getinfo($ci));
        $this->url = $url;

        if ($this->debug) {
            echo "=====post data======\r\n";
            var_dump($postfields);

            echo "=====headers======\r\n";
            print_r($headers);

            echo '=====request info====='."\r\n";
            print_r( curl_getinfo($ci) );

            echo '=====response====='."\r\n";
            print_r( $response );
        }
        curl_close ($ci);
        return $response;
    }
897144
@Override
    public int getAttributeAsArray(int index, TypedArrayDecoder tad) throws XMLStreamException
    {
        if (mCurrToken != START_ELEMENT) {
            throw new IllegalStateException(ErrorConsts.ERR_STATE_NOT_STELEM);
        }
        return mAttrCollector.decodeValues(index, tad, this);
    }
11643
protected function filterAttributesOnCreate(?string $index, iterable $attributes): iterable
    {
        if ($index !== null) {
            $pkName = $this->getModelSchemas()->getPrimaryKey($this->getModelClass());
            yield $pkName => $index;
        }

        $knownAttrAndTypes = $this->getModelSchemas()->getAttributeTypes($this->getModelClass());
        foreach ($attributes as $attribute => $value) {
            if (array_key_exists($attribute, $knownAttrAndTypes) === true) {
                yield $attribute => $value;
            }
        }
    }
862062
function _parseAttributes(&$response)
    {
        $attr = array();
        extract(unpack('Nflags', $this->_string_shift($response, 4)));
        // SFTPv4+ have a type field (a byte) that follows the above flag field
        foreach ($this->attributes as $key => $value) {
            switch ($flags & $key) {
                case NET_SFTP_ATTR_SIZE: // 0x00000001
                    // size is represented by a 64-bit integer, so we perhaps ought to be doing the following:
                    // $attr['size'] = new Math_BigInteger($this->_string_shift($response, 8), 256);
                    // of course, you shouldn't be using Net_SFTP to transfer files that are in excess of 4GB
                    // (0xFFFFFFFF bytes), anyway.  as such, we'll just represent all file sizes that are bigger than
                    // 4GB as being 4GB.
                    extract(unpack('Nupper/Nsize', $this->_string_shift($response, 8)));
                    if ($upper) {
                        $attr['size'] = 0xFFFFFFFF;
                    } else {
                        $attr['size'] = $size < 0 ? ($size & 0x7FFFFFFF) + 0x80000000 : $size;
                    }
                    break;
                case NET_SFTP_ATTR_UIDGID: // 0x00000002 (SFTPv3 only)
                    $attr+= unpack('Nuid/Ngid', $this->_string_shift($response, 8));
                    break;
                case NET_SFTP_ATTR_PERMISSIONS: // 0x00000004
                    $attr+= unpack('Npermissions', $this->_string_shift($response, 4));
                    break;
                case NET_SFTP_ATTR_ACCESSTIME: // 0x00000008
                    $attr+= unpack('Natime/Nmtime', $this->_string_shift($response, 8));
                    break;
                case NET_SFTP_ATTR_EXTENDED: // 0x80000000
                    extract(unpack('Ncount', $this->_string_shift($response, 4)));
                    for ($i = 0; $i < $count; $i++) {
                        extract(unpack('Nlength', $this->_string_shift($response, 4)));
                        $key = $this->_string_shift($response, $length);
                        extract(unpack('Nlength', $this->_string_shift($response, 4)));
                        $attr[$key] = $this->_string_shift($response, $length);                        
                    }
            }
        }
        return $attr;
    }
144127
public function getAttributes($orderIndex = 0)
    {
        $orderStatuses = $this->getOrderStatuses();
        return array_key_exists('attributes', $orderStatuses[$orderIndex])
            ? $orderStatuses[$orderIndex]['attributes'] : [];
    }
969804
private function loadIndexFile(string $indexFilepath): array
    {
        $this->status = IndexInterface::STATUS_LOADED;
        return \unserialize(\file_get_contents($indexFilepath));
    }
795927
public function renderResponse(Pagerfanta $pager, AttributeInterface $attribute = null)
    {
        $results = [];
        try {
            /** @noinspection PhpParamsInspection */
            $this->dataLoader->load($pager, 2); // Try to load results if array of EAV data
        } catch (\InvalidArgumentException $e) {
            // Do nothing, it just means that we have an array of scalar
        }
        foreach ($pager as $data) {
            if ($data instanceof DataInterface) {
                $results[] = $this->parseResult($data, $attribute);
            } else {
                $results[] = $this->parseScalarResult($data);
            }
        }

        $headers = [
            'Cache-Control' => 'private, no-cache, no-store, must-revalidate',
            'Pragma' => 'private',
            'Expires' => 0,
        ];

        $response = [
            'results' => $results,
            'pagination' => [
                'more' => $pager->hasNextPage(),
            ],
        ];

        return new JsonResponse($response, 200, $headers);
    }
919727
protected function getResultFromResponse(Response $response)
    {
        $result = [];

        foreach ($response->getData() as $element) {
            $attributes = $this->getAttributes($element);
            $attributes['type'] = $element['type'];

            $result[] = $attributes;
        }

        return $result;
    }
1013489
@Override
    public Object[][] getDataByIndex(String indexes) {
        validateResourceParams(resource);
        Preconditions.checkArgument(!StringUtils.isEmpty(indexes), "Indexes cannot be empty");
        logger.entering(indexes);
        Object[][] requestedData = getDataByIndex(DataProviderHelper.parseIndexString(indexes));
        logger.exiting((Object[]) requestedData);
        return requestedData;
    }
814633
def from_response(cls, response, attrs):
        
        proj = response['Projection']
        index = cls(proj['ProjectionType'], response['IndexName'],
                    attrs[response['KeySchema'][1]['AttributeName']],
                    proj.get('NonKeyAttributes'))
        index.response = response
        return index
163689
private function readRowFromAssoc(array $attributes, array $typeNames, AbstractPlatform $platform): array
    {
        $row = [];
        foreach ($this->readTypedAttributes($attributes, $typeNames, $platform) as $name => $value) {
            $row[$name] = $value;
        }

        return $row;
    }
972351
function _getIndexesInArray(attrs, attr) {
    var res = [];

    for (var i = 0; i < attrs.length; i++) {
        if (attrs[i].name === attr) res.push(i);
    }

    return res;
}
1001502
private function formatRows($response)
    {
        $rows = [];
        foreach ($response['results'] as $result) {
            $columns = $result['columns'];
            $tmpColumns = [];
            foreach ($result['data'] as $dat) {
                $i = 0;
                foreach ($dat['row'] as $row) {
                    $tmpColumns[$i][] = $row;
                    ++$i;
                }
            }
            $y = 0;
            foreach ($columns as $k => $col) {
                if (!empty($tmpColumns)) {
                    $rows[$col] = $tmpColumns[$k];
                    if (is_array($tmpColumns[$k])) {
                        foreach ($tmpColumns[$k] as $i => $el) {
                            if (is_array($el) && isset($el[0])) {
                                $el[0] = 'maybe relationship';
                                if (isset($response['results'][0]['data'][$k])) {
                                    $maybeRel = $response['results'][0]['data'][$k]['rest'][$y];
                                    if (isset($maybeRel['start'])) {
                                        $rows[$col][$i] = $this->getOnlyUsefulEdgeInfoFromRestFormat($maybeRel);
                                    }
                                    if (is_array($maybeRel)) {
                                        $areRels = false;
                                        foreach ($maybeRel as $rel) {
                                            if (isset($rel['start'])) {
                                                $areRels = true;
                                            }
                                        }
                                        if ($areRels) {
                                            $rows[$col][$i] = $this->getUsefulRestEdgeInfoFromCollection($maybeRel);
                                        }
                                    }
                                }

                            }
                        }
                    }
                }
                ++$y;
            }
        }

        return $rows;
    }