Example #1
0
 public static function setInputRaw($input)
 {
     if (is_string($input) | $input == false) {
         self::$input = $input;
     } else {
         throw new TelegramException("Log input is not a string");
     }
 }
Example #2
0
 /**
  * Set raw input data string
  *
  * @todo Possibly set this to private, since getInput overwrites the input anyway
  * @todo Why the "| $input == false"?
  *
  * @param string $input
  */
 public static function setInputRaw($input)
 {
     if (is_string($input) | $input == false) {
         self::$input = $input;
     } else {
         throw new TelegramException('Input must be a string!');
     }
 }
Example #3
0
 public static function getInput()
 {
     if ($update = self::$telegram->getCustomUpdate()) {
         self::$input = $update;
     } else {
         self::$input = file_get_contents('php://input');
     }
     self::log();
     return self::$input;
 }
Example #4
0
 public static function getUpdates($data)
 {
     if ($update = self::$telegram->getCustomUpdate()) {
         self::$input = $update;
     } else {
         self::$input = self::send('getUpdates', $data);
     }
     self::log();
     //TODO
     return self::$input;
 }
Example #5
0
 public static function getUpdates($data)
 {
     if ($update = self::$telegram->getCustomUpdate()) {
         //Cannot be used for testing yet json update have to be converted in a ServerResponse Object
         self::$input = $update;
     } else {
         self::$input = self::send('getUpdates', $data);
     }
     //In send methods is set input_raw
     self::log();
     return self::$input;
 }
Example #6
0
 /**
  * Set input from custom input or stdin and return it
  *
  * @return string
  */
 public static function getInput()
 {
     // First check if a custom input has been set, else get the PHP input.
     if (!($input = self::$telegram->getCustomInput())) {
         $input = file_get_contents('php://input');
     }
     // Make sure we have a string to work with.
     if (is_string($input)) {
         self::$input = $input;
     } else {
         throw new TelegramException('Input must be a string!');
     }
     TelegramLog::update(self::$input);
     return self::$input;
 }