Total Complexity | 7 |
Total Lines | 52 |
Duplicated Lines | 0 % |
Coverage | 72.72% |
Changes | 0 |
1 | <?php namespace Comodojo\Dispatcher\Request; |
||
22 | class Post { |
||
23 | |||
24 | use ParametersTrait; |
||
25 | |||
26 | protected $raw_parameters; |
||
27 | |||
28 | 7 | public function __construct() { |
|
29 | |||
30 | 7 | $this->parameters = self::getParameters(); |
|
31 | |||
32 | 7 | $this->raw_parameters = self::getRawParameters(); |
|
33 | |||
34 | 7 | } |
|
35 | |||
36 | public function getRaw() { |
||
37 | |||
38 | return $this->raw_parameters; |
||
39 | |||
40 | } |
||
41 | |||
42 | 7 | private static function getParameters() { |
|
43 | |||
44 | 7 | switch ($_SERVER['REQUEST_METHOD']) { |
|
45 | |||
46 | 7 | case 'POST': |
|
|
|||
47 | |||
48 | $parameters = $_POST; |
||
49 | |||
50 | break; |
||
51 | |||
52 | 7 | case 'PUT': |
|
53 | 7 | case 'DELETE': |
|
54 | |||
55 | parse_str(file_get_contents('php://input'), $parameters); |
||
56 | |||
57 | break; |
||
58 | |||
59 | 7 | default: |
|
60 | |||
61 | 7 | $parameters = array(); |
|
62 | |||
63 | 7 | break; |
|
64 | |||
65 | 7 | } |
|
66 | |||
67 | 7 | return $parameters; |
|
68 | |||
69 | } |
||
70 | |||
71 | 7 | private static function getRawParameters() { |
|
74 | |||
75 | } |
||
76 | |||
77 | } |
||
78 |
According to the PSR-2, the body of a case statement must start on the line immediately following the case statement.
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.