From 9f47c0fd4f94f45ce02c8c67ae59f5fc74f8ad9e Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Sat, 13 Feb 2016 01:05:20 +0000
Subject: [PATCH] [mod_pogoda] Poprawka błędnego wyświetlania danych w komendzie miasto
---
class/BotMessage.php | 31 ++++++++++++++++++++++---------
1 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/class/BotMessage.php b/class/BotMessage.php
index a958902..30416f8 100644
--- a/class/BotMessage.php
+++ b/class/BotMessage.php
@@ -2,58 +2,71 @@
class BotMessage {
/**
* Informacje o kliencie
- * @var BotUser
+ * @var BotUser $user
*/
protected $user;
+
/**
* Informacje o kliencie zgodne z poprzednią wersją Bota (dot. API IMified).
* Najczęściej równe {@link BotMessage::$user}
- * @var BotUser
+ * @var BotUser $userAlt
*/
protected $userAlt;
/**
* Sesja przypisana do użytkownika i modułu
- * @var BotSession
+ * @var BotSession $session
*/
protected $session;
/**
* Tekst otrzymany od API - bez zmian
- * @var string
+ * @var string $rawText
*/
protected $rawText;
/**
* Czysty tekst, tylko znaki ASCII, małe litery, podwójne spacje zamienione na pojedyncze
- * @var string
+ * @var string $text
*/
protected $text;
/**
- * Tablica obrazków (zobacz klasę BotImage) przesłanych do bota przez użytkownika.
- * @var array
+ * Tablica obrazków (zobacz {@link BotImage}) przesłanych do bota przez użytkownika.
+ * @var array $images
*/
protected $images = array();
/**
* Komenda, tylko znaki ASCII, małe litery
- * @var string
+ * @var string $command
*/
private $command;
/**
* Argumenty polecenia - oryginalne
- * @var string
+ * @var string $args
*/
private $args;
+ /**
+ * Umożliwia dostęp tylko do odczytu do prywanych zmiennych
+ * @param string $name Nazwa zmiennej
+ * @return mixed Wartość zmiennej prywatnej
+ */
function __get($name) {
return $this->$name;
}
+ /**
+ * Na podstawie nieprzetworzonej wiadomości ({@link BotMessage::$rawText})
+ * metoda ustawia wszystkie pola klasy.
+ * @param string $value Nieprzetworzona wiadomość
+ */
function setText($value) {
$this->rawText = $value;
+
+ $value = trim($value);
$this->text = funcs::utfToAscii($value);
$this->command = funcs::utfToAscii(trim(strtok($value, " \t\r\n")));
$this->args = trim(strtok(''));
--
Gitblit v1.9.1