# give/4.17.0/vendor/paypal/paypalhttp/lib/PayPalHttp/Serializer/Text.php

GiveWP – Donation Plugin and Fundraising Platform, version 4.17.0. 39 lines.

- Page: https://pluginprobe.com/plugins/give/4.17.0/code/vendor/paypal/paypalhttp/lib/PayPalHttp/Serializer/Text.php
- Raw: https://pluginprobe.com/plugins/give/4.17.0/raw/vendor/paypal/paypalhttp/lib/PayPalHttp/Serializer/Text.php
- Modified: 2020-10-28T01:02:06+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/give/4.17.0/code/vendor/paypal/paypalhttp/lib/PayPalHttp/Serializer/Text.php#L10-L20`.

```php
<?php

namespace PayPalHttp\Serializer;

use PayPalHttp\HttpRequest;
use PayPalHttp\Serializer;

/**
 * Class Text
 * @package PayPalHttp\Serializer
 *
 * Serializer for Text content types.
 */
class Text implements Serializer
{

    public function contentType()
    {
        return "/^text\\/.*/";
    }

    public function encode(HttpRequest $request)
    {
        $body = $request->body;
        if (is_string($body)) {
            return $body;
        }
        if (is_array($body)) {
            return json_encode($body);
        }
        return implode(" ", $body);
    }

    public function decode($data)
    {
        return $data;
    }
}

```
