Separates given string in key value parts.

@param string $body
@return array
7015
public function parseNewLineSeparatedBody($body)
    {
        $data = array();

        if (!$body) {
            return $data;
        }

        $parts = preg_split("/\\r?\\n/", $body);
        foreach ($parts as $str) {
            if (!$str) {
                continue;
            }

            list ($key, $value) = explode('=', $str);
            $data[$key] = $value;
        }

        return $data;
    }
595609
public function splitHttpAcceptHeader($header)
    {
        $values = [];
        foreach (array_filter(explode(',', $header)) as $value) {
            // Cut off any q-value that might come after a semi-colon
            if ($pos = strpos($value, ';')) {
                $q = (float) trim(substr($value, strpos($value, '=') + 1));
                $value = substr($value, 0, $pos);
            } else {
                $q = 1;
            }

            if (0 < $q) {
                $values[trim($value)] = $q;
            }
        }

        arsort($values);

        return array_keys($values);
    }
1041002
protected function unwrapEnvelope(array $body)
  {
    if (isset($body['data']))
    {
      return $body['data'];
    }
    else if (isset($body['items']))
    {
      $items = array();
      foreach ($body['items'] as $item)
      {
        $items[] = $item;
      }

      return $items;
    }
    return $body;
  }
1126274
public function segments($entity) {
		$result = [];

		if (strpos($entity->name, '::') !== false) {
			list($class, $child) = explode('::', $entity->name, 2);
			$result[$entity->name] = $child;
			$result[] = '::';
		} else {
			$class = $entity->name;
		}
		$parts = explode('/', $class);
		while ($parts) {
			$result[implode('/', $parts)] = end($parts);

			array_pop($parts);
			if ($parts) {
				$result[] = '\\';
			}
		}
		return array_reverse($result);
	}
37538
protected function parseResponse($body)
    {
        $this->historyCount = (int)$body->getElementsByTagName('historyEntry')->length;

        if ($this->historyCount > 0) {

            for ($i = 0; $i < $this->historyCount; $i++) {

                $this->history[$i] = [];

                $historyEntry = $body->getElementsByTagName('historyEntry')->item($i);

                for ($j = 0; $j < $historyEntry->childNodes->length; $j++) {

                    $name  = $historyEntry->childNodes->item($j)->tagName;
                    $value = $historyEntry->childNodes->item($j)->nodeValue;

                    $this->history[$i][$name] = $value;
                }
            }
        }
    }
525833
protected function splitKey(string $key)
    {
        if (!$this->multilevel) {
            return $key;
        }

        $slug_array = explode($this->separator, $key);

        if (count($slug_array) == 1) {
            return $key;
        }

        return $slug_array;
    }
1223472
protected function splitBodyHeader($input)
    {
        $pos = strpos($input, $this->params['crlf'] . $this->params['crlf']);
        if ($pos === false) {
            return false;
        }

        $crlf_len = strlen($this->params['crlf']);
        $header   = substr($input, 0, $pos);
        $body     = substr($input, $pos + 2 * $crlf_len);

        if (substr_compare($body, $this->params['crlf'], -$crlf_len) === 0) {
            $body = substr($body, 0, -$crlf_len);
        }

        return array($header, $body);
    }
1373251
protected function parseBody(array $body)
    {
        $jobs = [];
        if (!empty($body)) {
            if (is_string($body[0])) {
                foreach ($body as $element) {
                    $jobs[] = ['id' => $element];
                }
            } else {
                $keyValueResponse = new KeyValueResponse();
                $keyValueResponse->setCommand($this->command);

                foreach ($body as $element) {
                    $keyValueResponse->setBody($element);
                    $jobs[] = $keyValueResponse->parse();
                }
            }
        }
        return ['jobs' => $jobs];
    }
548822
protected function getProviders($body = '')
    {
        $regex = ($this->config['use_embed_prefix'] === true ? $this->urlEmbedRegex : $this->urlRegex);
        if (is_array($body)) {

            $body = array_filter($body, function ($arr) use ($regex) {
                return preg_match($regex, $arr);
            });

            $services = $this->providers->getAll($body);
        } elseif (preg_match_all($regex, $body, $matches)) {
            $services = $this->providers->getAll($matches['0']);
        } else {
            return array();
        }

        return $this->clean($services);
    }
728027
private function explode_signed_body($body, $boundary)
    {
        if (!$body) {
            return array();
        }

        $boundary     = '--' . $boundary;
        $boundary_len = strlen($boundary) + 2;

        // Find boundaries
        $start = strpos($body, $boundary) + $boundary_len;
        $end   = strpos($body, $boundary, $start);

        // Get signed body and signature
        $sig  = substr($body, $end + $boundary_len);
        $body = substr($body, $start, $end - $start - 2);

        // Cleanup signature
        $sig = substr($sig, strpos($sig, "\r\n\r\n") + 4);
        $sig = substr($sig, 0, strpos($sig, $boundary));

        return array($body, $sig);
    }
520871
public function DKIM_BodyC($body)
    {
        if ($body == '') {
            return "\r\n";
        }
        // stabilize line endings
        $body = str_replace("\r\n", "\n", $body);
        $body = str_replace("\n", "\r\n", $body);
        // END stabilize line endings
        while (substr($body, strlen($body) - 4, 4) == "\r\n\r\n") {
            $body = substr($body, 0, strlen($body) - 2);
        }
        return $body;
    }
531362
protected function parseResponse($body)
    {
        if ($body->getElementsByTagName('token')->length > 0) {
            $this->token = $body->getElementsByTagName('token')->item(0)->nodeValue;
        }

        if ($body->getElementsByTagName('apiKey')->length > 0) {
            $this->apiKey = $body->getElementsByTagName('apiKey')->item(0)->nodeValue;
        }

        if ($body->getElementsByTagName('errNo')->length > 0) {
            $this->errNo = (int)$body->getElementsByTagName('errNo')->item(0)->nodeValue;
        }

        if ($body->getElementsByTagName('errText')->length > 0) {
            $this->errText = $body->getElementsByTagName('errText')->item(0)->nodeValue;
        }

        if ($body->getElementsByTagName('location')->length > 0) {
            $this->location = $body->getElementsByTagName('location')->item(0)->nodeValue;
        }
    }
244079
private function parse($body)
  {
      parse_str($body, $response_array);
      if ($response_array['ACK'] == self::FAILURE) {
          $error_message = 'Error code ('.$response_array['L_ERRORCODE0'].")\n ".$response_array['L_SHORTMESSAGE0'].".\n Reason: ".$response_array['L_LONGMESSAGE0'];
          Merchant_Logger::error_log($error_message);
      }

      return $response_array;
  }
887237
protected function parseRequestBody($requestBody)
    {
        $body = $files = [];
        if(is_string($requestBody))
        {
            $body = $requestBody;
        }
        else if(is_array($requestBody))
        {
            foreach($requestBody as $k => $v)
            {
                if($v instanceof UploadedFile)
                {
                    $files[] = $v;
                }
                else
                {
                    $body[$k] = $v;
                }
            }
            $body = http_build_query($body, '', '&');
        }
        else
        {
            throw new \InvalidArgumentException('$requestBody only can be string or array');
        }
        return [$body, $files];
    }
274411
public function extractFromHeader(string $key, string $value) : array
    {
        $meta = $this->header($key);

        if (false !== strpos($meta, $value)) {
            $meta = trim(str_replace($value, '', $meta));

            return explode(' ', $meta) ?? [];
        }

        return [];
    }
683189
protected function parseResponse($body)
    {
        $this->paramCount = $body->getElementsByTagName('parameter')->length;

        if ($this->paramCount > 0) {
            for ($i = 0; $i < $this->paramCount; $i++) {

                $parameter = $body->getElementsByTagName('parameter')->item($i);

                $name  = $parameter->getElementsByTagName('name')->item(0)->nodeValue;
                $value = $parameter->getElementsByTagName('value')->item(0)->nodeValue;

                $this->transaction[$name] = $value;
            }
        }
    }
478054
private function parse($body)
    {
        $body = json_decode($body, true);

        if (isset($body['response'])) {
            return new Options($body['response']);
        }

        return new Options($body);
    }