Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
response.php
1<?php
2namespace Bitrix\Main;
3
4abstract class Response
5{
7 protected $content;
8
9 public function __construct()
10 {
11 }
12
13 public function clear()
14 {
15 }
16
17 public function flush($text = '')
18 {
19 $this->writeBody($text);
20 }
21
31 public function setContent($content)
32 {
33 if (!$this->checkContent($content))
34 {
35 throw new ArgumentTypeException('content', 'string');
36 }
37
38 $this->content = (string)$content;
39
40 return $this;
41 }
42
52 public function appendContent($content)
53 {
54 if (!$this->checkContent($content))
55 {
56 throw new ArgumentTypeException('content', 'string');
57 }
58
59 $this->content .= (string)$content;
60
61 return $this;
62 }
63
64 protected function checkContent($content)
65 {
66 return (
67 $content === null ||
68 is_string($content) ||
69 is_numeric($content) ||
70 is_callable(array($content, '__toString'))
71 );
72 }
73
79 public function getContent()
80 {
81 return $this->content;
82 }
83
89 public function send()
90 {
91 $this->flush($this->content);
92 }
93
94 protected function writeBody($text)
95 {
96 echo $text;
97 }
98}
appendContent($content)
Definition response.php:52
setContent($content)
Definition response.php:31
checkContent($content)
Definition response.php:64