commit | author | age
|
8bd4d9
|
1 |
<?php |
JK |
2 |
/** |
|
3 |
* Klasa konwertuje wiadomość ({@link BotMsg}) do formatu odpowiedniego dla interfejsu WWW |
|
4 |
*/ |
|
5 |
class BotMsgHTTP implements BotMsgInterface { |
|
6 |
private $html = ''; |
|
7 |
|
|
8 |
/** |
|
9 |
* @param BotMsg $msg Wiadomość do przekonwertowania |
|
10 |
*/ |
|
11 |
function __construct(BotMsg $msg) { |
|
12 |
$this->html = $msg->getHTML(); |
|
13 |
} |
|
14 |
|
|
15 |
/** |
|
16 |
* @return string |
|
17 |
* Zwraca wiadomość HTML |
|
18 |
*/ |
|
19 |
function __toString() { |
|
20 |
return $this->html; |
|
21 |
} |
|
22 |
|
|
23 |
/** |
|
24 |
* @return string |
|
25 |
* Zwraca wiadomość w formacie HTML |
|
26 |
*/ |
|
27 |
function getHTML() { |
|
28 |
return $this->html; |
|
29 |
} |
|
30 |
|
|
31 |
function sendPullResponse() { |
|
32 |
header('Content-Type: text/html; charset=utf-8'); |
|
33 |
echo $this; |
|
34 |
} |
|
35 |
} |
|
36 |
?> |