Code Duplication    Length = 13-13 lines in 2 locations

src/VcrHandler.php 2 locations

@@ 138-150 (lines=13) @@
135
     * 
136
     * @return string
137
     */
138
    protected static function encodeBodyFrom($response)
139
    {
140
        $response = static::ensureResponse($response);
141
        $body = (string) $response->getBody();
142
143
        if (static::getConfig(self::CONFIG_ONLY_ENCODE_BINARY)
144
            && ! static::isBinary($response)
145
        ) {
146
            return $body;
147
        }
148
149
        return \base64_encode($body);
150
    }
151
152
    /**
153
     * Decode body content from given response.
@@ 159-171 (lines=13) @@
156
     * 
157
     * @return string
158
     */
159
    protected static function decodeBodyFrom($response)
160
    {
161
        $response = static::ensureResponse($response);
162
        $body = (string) $response->getBody();
163
164
        if (static::getConfig(self::CONFIG_ONLY_ENCODE_BINARY)
165
            && ! static::isBinary($response)
166
        ) {
167
            return $body;
168
        }
169
170
        return \base64_decode($body);
171
    }
172
173
    /**
174
     * Decodes every responses body from base64