| Conditions | 3 |
| Paths | 2 |
| Total Lines | 11 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 39 | public function send(IRequest $httpRequest, nette_iresponse $httpResponse): void |
||
| 40 | { |
||
| 41 | 1 | $httpResponse->setContentType($this->getContentType() ?: 'application/javascript', 'UTF-8'); |
|
| 42 | |||
| 43 | 1 | $data = []; |
|
| 44 | 1 | $data['response'] = $this->data; |
|
| 45 | 1 | $data['status'] = $httpResponse->getCode(); |
|
| 46 | 1 | $data['headers'] = $httpResponse->getHeaders(); |
|
| 47 | |||
| 48 | 1 | $callback = $httpRequest->getQuery('jsonp') ? Strings::webalize(strval($httpRequest->getQuery('jsonp')), null, false) : ''; |
|
| 49 | 1 | echo $callback . '(' . $this->mapper->stringify($data, $this->isPrettyPrint()) . ');'; |
|
| 50 | 1 | } |
|
| 52 |