Fix raw data.

@param string $data
@return array
169040
private function fixer($data, $noWrite = false)
	{
		if (
			$noWrite or $this->writeCache($data)
		) {
			$data = $noWrite ? $data : json_decode($data, true);
			if ($data['success'] === true) {
				if (isset($data['data']['tasks']['items'])) {
					$r = [];
					foreach ($data['data']['tasks']['items'] as $k => $v) {
						$responses = [];
						foreach ($v['responses'] as $j => $q) {
							$responses[] = [
								"content" => $q['content']
							];
						}
						$r[] = [
							"content" 	=> $v['task']['content'],
							"responses"	=> $responses
						];
					}
					return $r;
				}
			}
		}
		return false;
	}
420957
public static function decodeData($data)
    {
        if (\is_array($data)) {
            foreach ($data as $key => $value) {
                $data[$key] = \urldecode($value);
            }

            return $data;
        }

        return \urldecode($data);
    }
430072
private static function sanitize($data)
    {
        $data = trim($data);
        $data = stripslashes($data);
        $data = htmlspecialchars($data);
        return $data;
    }
1036201
private function cleanData(array $data) : array
  {
    foreach($data as $key => $value) {
      $data[$key] = $this->replace($key, $value);
    }

    return $data;
  }
83270
protected function decodeData($data): array
    {
        if (!\is_array($data)) {
            return [];
        }

        // Decode JSON encoded fields and merge them to data.
        if (isset($data['_json'])) {
            $data = array_replace_recursive($data, $this->jsonDecode($data['_json']));
            unset($data['_json']);
        }

        return $data;
    }
121995
private function fixIe($data)
    {
        $data = preg_replace(
            '#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?expression[\x00-\x20]*\([^>]*+>#i',
            '$1>',
            $data
        );
        $data = preg_replace(
            '#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?behaviour[\x00-\x20]*\([^>]*+>#i',
            '$1>',
            $data
        );
        $data = preg_replace(
            '#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i
            [\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:*[^>]*+>#iu',
            '$1>',
            $data
        );

        return $data;
    }
829066
protected function _decodeData(array $data)
    {
        $result = [];

        if (\is_array($data[0])) {
            foreach ($data[0] as $k => $v) {
                $result[$k] = $this->_decodeData([
                    $data[0][$k], $data[1][$k], $data[2][$k], $data[3][$k], $data[4][$k]
                ]);
            }

            return $result;
        }

        return [
            'name' => $data[0],
            'type' => $data[1],
            'tmp_name' => $data[2],
            'error' => $data[3],
            'size' => $data[4]
        ];
    }
1098950
protected function unpackData($data)
	{
		$this->values = $data['values'];
		$this->isInvalid = $data['isInvalid'];
		$this->messages = $data['messages'];
	}
1266749
public function parseReadData($data)
	{
		$results = array();

		foreach ($data as $row) {
			if (is_array($row)) {
				$key = $row['key'];
				$value = $row['value'];
			} elseif (is_object($row)) {
				$key = $row->key;
				$value = $row->value;
			} else {
				$msg = 'Expected array or object, got '.gettype($row);
				throw new \UnexpectedValueException($msg);
			}

			SettingsUtilities::set($results, $key, $value);
		}

		return $results;
	}
615480
protected function parseQueryPair(string $data): array
    {
        $data = explode('=', $data, 2);
        if (1 === count($data)) {
            $data[] = '';
        }

        return array_map(__NAMESPACE__ . '\decode', $data);
    }
52910
protected function convert($data)
    {
        foreach ($data[0] as $key => $value) {
            if (!$this->_kept && !$this->_stashed) {
                $this->$key = $value;
                $this->setKey($key, $value);
            } else {
                if ($this->_kept) {
                    $this->_keptData[$key] = $value;
                }
                if ($this->_stashed) {
                    $this->_stashedData[$key] = $value;
                }
            }

            $this->data[$key] = $value;
        }
    }
375979
public function format($data)
    {
        foreach ($this->rules as $oldKey => $newKey) {
            if ($this->isRegex($oldKey)) {
                $this->remapRecursively($data, $oldKey, $newKey);
            } else {
                $this->remap($data, $oldKey, $newKey);
            }
        }

        $data->unsetNull();

        return $data;
    }
963990
public function withoutFalseyValues($data)
    {
        for ($i = 0; $i < count($data[ClientResource::FIELD_RESOURCES]); $i++) {
            if (!$data[ClientResource::FIELD_RESOURCES][$i]['value']) {
                unset($data[ClientResource::FIELD_RESOURCES][$i]);
            }
        }

        // Resort array
        $data[ClientResource::FIELD_RESOURCES] = array_values($data[ClientResource::FIELD_RESOURCES]);

        return $data;
    }
22063
private function _repair_row( $data = array(), $attr = array() ) {
		$row = array();
		foreach( $data as $key => $value ) {
			if ( !$value instanceof HTML || ( $value->name != 'td' && $value->name != 'th' ) ) {
				$value = static::cell( (string) $value );
			}
			if ( is_string( $key ) ) {
				$row[$key] = $value;
			} else {
				$row[] = $value;
			}
		}
		return array( $row, $attr );
	}
593971
private function decode($data, $raw)
    {
        if (is_array($data)) {
            foreach ($data as $k => &$v) {
                $v = $this->decode($v, $raw[$k]);
            }
            return $data;
        }

        $data = $this->decodeBoolean($data, $raw);
        $data = $this->decodeNull($data, $raw);

        if (is_numeric($data) && ((string)($data + 0) === $data))
            return $data + 0;

        if (is_string($raw) && empty($raw))
            return "";

        return $data;
    }
959248
protected function cleanData($data)
    {
        $originalFields = $this->getFields();
        $uniqueId       = $this->getUniqueId();
        $fields         = array_merge(
            $originalFields,
            array($uniqueId));

        // clean data from data item
        foreach ($data as $fieldName => $value) {
            if (array_search($fieldName, $fields) === false) {
                unset($data[ $fieldName ]);
            }
        }

        if (isset($data[ $uniqueId ]) && empty($data[ $uniqueId ])) {
            unset($data[ $uniqueId ]);
        }

        return $data;
    }
356367
protected function fixParameters(array &$data)
    {
        foreach ($data as $name => $value) {
            if (is_array($value)) {
                $this->fixParameters($value);
            }
            $parts  = explode('.', $name);
            $result = &$data;
            while (null !== ($part = array_shift($parts))) {
                if (count($parts)) {
                    if (!isset($result[$part])) {
                        $result[$part] = [];
                    }
                    $result = &$result[$part];
                } else {
                    $result[$part] = $value;
                }
            }
        }
    }