Completed
Push — master ( 8ec403...fa21f3 )
by Evgeny
03:18
created

FormParser   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 60%

Importance

Changes 0
Metric Value
dl 0
loc 31
ccs 6
cts 10
cp 0.6
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A params() 0 12 3
A request() 0 4 1
1
<?php
2
/**
3
 * Copyright 2016, Cake Development Corporation (http://cakedc.com)
4
 *
5
 * Licensed under The MIT License
6
 * Redistributions of files must retain the above copyright notice.
7
 *
8
 * @copyright Copyright 2016, Cake Development Corporation (http://cakedc.com)
9
 * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
10
 */
11
12
namespace CakeDC\Api\Service\RequestParser;
13
14
/**
15
 * Parse form based data representation.
16
 */
17
class FormParser extends BaseParser
18
{
19
20
    /**
21
     * Resolves the request params as a key => value array.
22
     *
23
     * @return array
24
     */
25 51
    public function params()
26
    {
27 51
        $request = $this->_service->request();
28 51
		if ($request == null) {
29
			stackTrace();
30
		}
31 51
        if ($request->is(['post', 'put'])) {
32 18
            return $request->data;
33
        }
34
35 33
        return $request->query;
36
    }
37
38
    /**
39
     * Processes the HTTP request.
40
     *
41
     * @return bool
42
     */
43
    public function request()
44
    {
45
        return true;
46
    }
47
}
48