@@ -40,19 +40,19 @@ discard block |
||
40 | 40 | { |
41 | 41 | $inputs = $this->app->get($this->method); |
42 | 42 | |
43 | - $content = json_decode($this->app['request']->getContent(),1); |
|
43 | + $content = json_decode($this->app['request']->getContent(), 1); |
|
44 | 44 | |
45 | - if(is_array($inputs) && count($inputs)){ |
|
45 | + if (is_array($inputs) && count($inputs)) { |
|
46 | 46 | |
47 | - if(isset($inputs[$this->client->getClientName()])){ |
|
47 | + if (isset($inputs[$this->client->getClientName()])) { |
|
48 | 48 | return $inputs[$this->client->getClientName()]; |
49 | 49 | } |
50 | 50 | return $inputs; |
51 | 51 | } |
52 | 52 | |
53 | - if(is_array($content)){ |
|
53 | + if (is_array($content)) { |
|
54 | 54 | |
55 | - if(isset($content[$this->client->getClientName()])){ |
|
55 | + if (isset($content[$this->client->getClientName()])) { |
|
56 | 56 | return $content[$this->client->getClientName()]; |
57 | 57 | } |
58 | 58 | return $content; |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | |
61 | 61 | $this->inputVars(); |
62 | 62 | |
63 | - if(is_array($GLOBALS[ '_PUT' ])){ |
|
64 | - return $GLOBALS[ '_PUT' ]; |
|
63 | + if (is_array($GLOBALS['_PUT'])) { |
|
64 | + return $GLOBALS['_PUT']; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | return []; |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | // Fetch content and determine boundary |
94 | 94 | $boundary = substr($raw_data, 0, strpos($raw_data, "\r\n")); |
95 | 95 | |
96 | - if(empty($boundary)){ |
|
97 | - parse_str($raw_data,$data); |
|
98 | - $GLOBALS[ '_PUT' ] = $data; |
|
96 | + if (empty($boundary)) { |
|
97 | + parse_str($raw_data, $data); |
|
98 | + $GLOBALS['_PUT'] = $data; |
|
99 | 99 | return; |
100 | 100 | } |
101 | 101 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | |
106 | 106 | foreach ($parts as $part) { |
107 | 107 | // If this is the last part, break |
108 | - if ($part == "--\r\n") break; |
|
108 | + if ($part=="--\r\n") break; |
|
109 | 109 | |
110 | 110 | // Separate content from headers |
111 | 111 | $part = ltrim($part, "\r\n"); |
@@ -131,10 +131,10 @@ discard block |
||
131 | 131 | list(, $type, $name) = $matches; |
132 | 132 | |
133 | 133 | //Parse File |
134 | - if( isset($matches[4]) ) |
|
134 | + if (isset($matches[4])) |
|
135 | 135 | { |
136 | 136 | //if labeled the same as previous, skip |
137 | - if( isset( $_FILES[ $matches[ 2 ] ] ) ) |
|
137 | + if (isset($_FILES[$matches[2]])) |
|
138 | 138 | { |
139 | 139 | continue; |
140 | 140 | } |
@@ -143,15 +143,15 @@ discard block |
||
143 | 143 | $filename = $matches[4]; |
144 | 144 | |
145 | 145 | //get tmp name |
146 | - $filename_parts = pathinfo( $filename ); |
|
147 | - $tmp_name = tempnam( ini_get('upload_tmp_dir'), $filename_parts['filename']); |
|
146 | + $filename_parts = pathinfo($filename); |
|
147 | + $tmp_name = tempnam(ini_get('upload_tmp_dir'), $filename_parts['filename']); |
|
148 | 148 | |
149 | 149 | //populate $_FILES with information, size may be off in multibyte situation |
150 | - $_FILES[ $matches[ 2 ] ] = array( |
|
150 | + $_FILES[$matches[2]] = array( |
|
151 | 151 | 'error'=>0, |
152 | 152 | 'name'=>$filename, |
153 | 153 | 'tmp_name'=>$tmp_name, |
154 | - 'size'=>strlen( $body ), |
|
154 | + 'size'=>strlen($body), |
|
155 | 155 | 'type'=>$value |
156 | 156 | ); |
157 | 157 | |
@@ -161,12 +161,12 @@ discard block |
||
161 | 161 | //Parse Field |
162 | 162 | else |
163 | 163 | { |
164 | - $data[$name] = substr($body, 0, strlen($body) - 2); |
|
164 | + $data[$name] = substr($body, 0, strlen($body)-2); |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | |
168 | 168 | } |
169 | - $GLOBALS[ '_PUT' ] = $data; |
|
169 | + $GLOBALS['_PUT'] = $data; |
|
170 | 170 | return; |
171 | 171 | } |
172 | 172 |
@@ -84,8 +84,9 @@ discard block |
||
84 | 84 | |
85 | 85 | /* Read the data 1 KB at a time |
86 | 86 | and write to the file */ |
87 | - while ($chunk = fread($putdata, 1024)) |
|
88 | - $raw_data .= $chunk; |
|
87 | + while ($chunk = fread($putdata, 1024)) { |
|
88 | + $raw_data .= $chunk; |
|
89 | + } |
|
89 | 90 | |
90 | 91 | /* Close the streams */ |
91 | 92 | fclose($putdata); |
@@ -105,7 +106,9 @@ discard block |
||
105 | 106 | |
106 | 107 | foreach ($parts as $part) { |
107 | 108 | // If this is the last part, break |
108 | - if ($part == "--\r\n") break; |
|
109 | + if ($part == "--\r\n") { |
|
110 | + break; |
|
111 | + } |
|
109 | 112 | |
110 | 113 | // Separate content from headers |
111 | 114 | $part = ltrim($part, "\r\n"); |