Passed
Pull Request — master (#59)
by Raúl
04:00
created

FormHandler::parse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 5
rs 10
1
<?php
2
/**
3
 * Mime Type: application/x-www-urlencoded
4
 * @author Nathan Good <[email protected]>
5
 */
6
7
namespace Httpful\Handlers;
8
9
class FormHandler extends MimeHandlerAdapter 
10
{
11
    /**
12
     * @param string $body
13
     * @return mixed
14
     */
15
    public function parse($body)
16
    {
17
        $parsed = array();
18
        parse_str($body, $parsed);
19
        return $parsed;
20
    }
21
    
22
    /**
23
     * @param mixed $payload
24
     * @return string
25
     */
26
    public function serialize($payload)
27
    {
28
        return http_build_query($payload, null, '&');
29
    }
30
}