@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | public function __construct(BaseService $service, $body) |
| 38 | 38 | { |
| 39 | 39 | $this->service = $service; |
| 40 | - $this->data = trim(str_replace("\r", '', $body)); // removes windows specific character |
|
| 40 | + $this->data = trim(str_replace("\r", '', $body)); // removes windows specific character |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | protected function processSubRequest(&$newContext) |
| 94 | 94 | { |
| 95 | - $newHost = new ServiceHost($newContext); |
|
| 95 | + $newHost = new ServiceHost($newContext); |
|
| 96 | 96 | $oldHost = $this->getService()->getHost(); |
| 97 | 97 | $this->getService()->setHost($newHost); |
| 98 | 98 | $this->getService()->handleRequest(); |
@@ -116,8 +116,7 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | $response = ''; |
| 118 | 118 | $splitter = false === $this->changeSetBoundary ? |
| 119 | - '' : |
|
| 120 | - '--' . $this->changeSetBoundary . $ODataEOL; |
|
| 119 | + '' : '--' . $this->changeSetBoundary . $ODataEOL; |
|
| 121 | 120 | $raw = $this->getRawRequests(); |
| 122 | 121 | foreach ($raw as $contentID => &$workingObject) { |
| 123 | 122 | $headers = $workingObject->outgoingResponse()->getHeaders(); |
@@ -139,16 +138,14 @@ discard block |
||
| 139 | 138 | } |
| 140 | 139 | $response .= trim($splitter); |
| 141 | 140 | $response .= false === $this->changeSetBoundary ? |
| 142 | - $ODataEOL : |
|
| 143 | - '--' . $ODataEOL; |
|
| 141 | + $ODataEOL : '--' . $ODataEOL; |
|
| 144 | 142 | $response = 'Content-Length: ' . |
| 145 | 143 | strlen($response) . |
| 146 | 144 | $ODataEOL . |
| 147 | 145 | $ODataEOL . |
| 148 | 146 | $response; |
| 149 | 147 | $response = false === $this->changeSetBoundary ? |
| 150 | - $response : |
|
| 151 | - 'Content-Type: multipart/mixed; boundary=' . |
|
| 148 | + $response : 'Content-Type: multipart/mixed; boundary=' . |
|
| 152 | 149 | $this->changeSetBoundary . |
| 153 | 150 | $ODataEOL . |
| 154 | 151 | $response; |
@@ -158,7 +155,7 @@ discard block |
||
| 158 | 155 | public function handleData() |
| 159 | 156 | { |
| 160 | 157 | list($headerBlock, $contentBlock) = explode("\n\n", $this->getData(), 2); |
| 161 | - $headers = self::parse_headers ($headerBlock); |
|
| 158 | + $headers = self::parse_headers($headerBlock); |
|
| 162 | 159 | $this->changeSetBoundary = $headers['Content-Type']['boundary']; |
| 163 | 160 | $prefix = 'HTTP_'; |
| 164 | 161 | $matches = array_filter(explode('--' . $this->changeSetBoundary, $contentBlock)); |
@@ -175,8 +172,8 @@ discard block |
||
| 175 | 172 | $contentID = array_key_exists('Content-ID', $requestHeadersArray) ? $requestHeadersArray['Content-ID'] : $contentIDinit; |
| 176 | 173 | $inboundRequestHeaders = []; |
| 177 | 174 | $skip = true; |
| 178 | - foreach(explode("\n", $requestHeaders) as $headerLine){ |
|
| 179 | - if($skip){ |
|
| 175 | + foreach (explode("\n", $requestHeaders) as $headerLine) { |
|
| 176 | + if ($skip) { |
|
| 180 | 177 | $skip = false; |
| 181 | 178 | continue; |
| 182 | 179 | } |
@@ -218,16 +215,16 @@ discard block |
||
| 218 | 215 | $results = []; |
| 219 | 216 | foreach (array_filter(explode($splitter, trim($headers))) as $line) { |
| 220 | 217 | |
| 221 | - list ($key, $value) = strpos($line,$assignmentChar) !== false ? explode($assignmentChar, $line, 2) : ['default', $line]; |
|
| 218 | + list ($key, $value) = strpos($line, $assignmentChar) !== false ? explode($assignmentChar, $line, 2) : ['default', $line]; |
|
| 222 | 219 | $key = trim($key); |
| 223 | 220 | $value = trim($value); |
| 224 | - if(strpos($value, ';') !== false){ |
|
| 225 | - $value = self::parse_headers($value,';','='); |
|
| 221 | + if (strpos($value, ';') !== false) { |
|
| 222 | + $value = self::parse_headers($value, ';', '='); |
|
| 226 | 223 | } |
| 227 | 224 | if (isset($results[$key])) { |
| 228 | 225 | if (is_array($results[$key])) { |
| 229 | 226 | $results[$key][] = $value; |
| 230 | - }else { |
|
| 227 | + } else { |
|
| 231 | 228 | $results[$key] = [$results[$key], $value]; |
| 232 | 229 | } |
| 233 | 230 | } else { |
@@ -268,9 +268,9 @@ |
||
| 268 | 268 | /** |
| 269 | 269 | * @param string $contentID |
| 270 | 270 | */ |
| 271 | - public function applyContentID(string $contentID,string $contentIdValue): void |
|
| 271 | + public function applyContentID(string $contentID, string $contentIdValue): void |
|
| 272 | 272 | { |
| 273 | - $this->rawInput = str_replace('$' . $contentID, $contentIdValue, $this->rawInput); |
|
| 273 | + $this->rawInput = str_replace('$' . $contentID, $contentIdValue, $this->rawInput); |
|
| 274 | 274 | $this->rawUrl = str_replace('$' . $contentID, $contentIdValue, $this->rawUrl); |
| 275 | 275 | } |
| 276 | 276 | } |