Commit 80c5981c authored by LONGMAN's avatar LONGMAN

Fixed exception bug

parent e68b85a1
...@@ -122,7 +122,7 @@ class DateCommand extends Command ...@@ -122,7 +122,7 @@ class DateCommand extends Command
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($http_code !== 200) { if ($http_code !== 200) {
throw new Exception('Error receiving data from url'); throw new \Exception('Error receiving data from url');
} }
curl_close($ch); curl_close($ch);
......
...@@ -36,7 +36,7 @@ class WeatherCommand extends Command ...@@ -36,7 +36,7 @@ class WeatherCommand extends Command
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($http_code !== 200) { if ($http_code !== 200) {
throw new Exception('Error receiving data from url'); throw new \Exception('Error receiving data from url');
} }
curl_close($ch); curl_close($ch);
......
...@@ -23,7 +23,7 @@ class Chat ...@@ -23,7 +23,7 @@ class Chat
$this->id = isset($data['id']) ? $data['id'] : null; $this->id = isset($data['id']) ? $data['id'] : null;
if (empty($this->id)) { if (empty($this->id)) {
throw new Exception('id is empty!'); throw new \Exception('id is empty!');
} }
} }
......
...@@ -64,19 +64,19 @@ class Message ...@@ -64,19 +64,19 @@ class Message
$this->message_id = isset($data['message_id']) ? $data['message_id'] : null; $this->message_id = isset($data['message_id']) ? $data['message_id'] : null;
if (empty($this->message_id)) { if (empty($this->message_id)) {
throw new Exception('message_id is empty!'); throw new \Exception('message_id is empty!');
} }
$this->from = isset($data['from']) ? $data['from'] : null; $this->from = isset($data['from']) ? $data['from'] : null;
if (empty($this->from)) { if (empty($this->from)) {
throw new Exception('from is empty!'); throw new \Exception('from is empty!');
} }
$this->from = new User($this->from); $this->from = new User($this->from);
$this->date = isset($data['date']) ? $data['date'] : null; $this->date = isset($data['date']) ? $data['date'] : null;
if (empty($this->date)) { if (empty($this->date)) {
throw new Exception('date is empty!'); throw new \Exception('date is empty!');
} }
$this->chat = isset($data['chat']) ? $data['chat'] : null; $this->chat = isset($data['chat']) ? $data['chat'] : null;
......
...@@ -28,7 +28,7 @@ class Update ...@@ -28,7 +28,7 @@ class Update
$message = isset($data['message']) ? $data['message'] : null; $message = isset($data['message']) ? $data['message'] : null;
if (empty($update_id)) { if (empty($update_id)) {
throw new Exception('update_id is empty!'); throw new \Exception('update_id is empty!');
} }
$this->update_id = $update_id; $this->update_id = $update_id;
......
...@@ -25,12 +25,12 @@ class User ...@@ -25,12 +25,12 @@ class User
$this->id = isset($data['id']) ? $data['id'] : null; $this->id = isset($data['id']) ? $data['id'] : null;
if (empty($this->id)) { if (empty($this->id)) {
throw new Exception('id is empty!'); throw new \Exception('id is empty!');
} }
$this->first_name = isset($data['first_name']) ? $data['first_name'] : null; $this->first_name = isset($data['first_name']) ? $data['first_name'] : null;
if (empty($this->first_name)) { if (empty($this->first_name)) {
throw new Exception('first_name is empty!'); throw new \Exception('first_name is empty!');
} }
$this->last_name = isset($data['last_name']) ? $data['last_name'] : null; $this->last_name = isset($data['last_name']) ? $data['last_name'] : null;
......
...@@ -98,7 +98,7 @@ class Request ...@@ -98,7 +98,7 @@ class Request
public static function sendMessage(array $data) { public static function sendMessage(array $data) {
if (empty($data)) { if (empty($data)) {
throw new Exception('Data is empty!'); throw new \Exception('Data is empty!');
} }
$result = self::send('sendMessage', $data); $result = self::send('sendMessage', $data);
......
...@@ -163,14 +163,14 @@ class Telegram ...@@ -163,14 +163,14 @@ class Telegram
if (empty($this->input)) { if (empty($this->input)) {
throw new Exception('Input is empty!'); throw new \Exception('Input is empty!');
} }
$post = json_decode($this->input, true); $post = json_decode($this->input, true);
if (empty($post)) { if (empty($post)) {
throw new Exception('Invalid JSON!'); throw new \Exception('Invalid JSON!');
} }
...@@ -230,7 +230,7 @@ class Telegram ...@@ -230,7 +230,7 @@ class Telegram
*/ */
public function addCommandsPath($folder) { public function addCommandsPath($folder) {
if (!is_dir($folder)) { if (!is_dir($folder)) {
throw new Exception('Commands folder not exists!'); throw new \Exception('Commands folder not exists!');
} }
$this->commands_dir[] = $folder; $this->commands_dir[] = $folder;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment