Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
TelegramBot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
TelegramBot
Commits
80c5981c
Commit
80c5981c
authored
Jun 30, 2015
by
LONGMAN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed exception bug
parent
e68b85a1
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
13 additions
and
13 deletions
+13
-13
DateCommand.php
src/Commands/DateCommand.php
+1
-1
WeatherCommand.php
src/Commands/WeatherCommand.php
+1
-1
Chat.php
src/Entities/Chat.php
+1
-1
Message.php
src/Entities/Message.php
+3
-3
Update.php
src/Entities/Update.php
+1
-1
User.php
src/Entities/User.php
+2
-2
Request.php
src/Request.php
+1
-1
Telegram.php
src/Telegram.php
+3
-3
No files found.
src/Commands/DateCommand.php
View file @
80c5981c
...
...
@@ -122,7 +122,7 @@ class DateCommand extends Command
$http_code
=
curl_getinfo
(
$ch
,
CURLINFO_HTTP_CODE
);
if
(
$http_code
!==
200
)
{
throw
new
Exception
(
'Error receiving data from url'
);
throw
new
\
Exception
(
'Error receiving data from url'
);
}
curl_close
(
$ch
);
...
...
src/Commands/WeatherCommand.php
View file @
80c5981c
...
...
@@ -36,7 +36,7 @@ class WeatherCommand extends Command
$http_code
=
curl_getinfo
(
$ch
,
CURLINFO_HTTP_CODE
);
if
(
$http_code
!==
200
)
{
throw
new
Exception
(
'Error receiving data from url'
);
throw
new
\
Exception
(
'Error receiving data from url'
);
}
curl_close
(
$ch
);
...
...
src/Entities/Chat.php
View file @
80c5981c
...
...
@@ -23,7 +23,7 @@ class Chat
$this
->
id
=
isset
(
$data
[
'id'
])
?
$data
[
'id'
]
:
null
;
if
(
empty
(
$this
->
id
))
{
throw
new
Exception
(
'id is empty!'
);
throw
new
\
Exception
(
'id is empty!'
);
}
}
...
...
src/Entities/Message.php
View file @
80c5981c
...
...
@@ -64,19 +64,19 @@ class Message
$this
->
message_id
=
isset
(
$data
[
'message_id'
])
?
$data
[
'message_id'
]
:
null
;
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
;
if
(
empty
(
$this
->
from
))
{
throw
new
Exception
(
'from is empty!'
);
throw
new
\
Exception
(
'from is empty!'
);
}
$this
->
from
=
new
User
(
$this
->
from
);
$this
->
date
=
isset
(
$data
[
'date'
])
?
$data
[
'date'
]
:
null
;
if
(
empty
(
$this
->
date
))
{
throw
new
Exception
(
'date is empty!'
);
throw
new
\
Exception
(
'date is empty!'
);
}
$this
->
chat
=
isset
(
$data
[
'chat'
])
?
$data
[
'chat'
]
:
null
;
...
...
src/Entities/Update.php
View file @
80c5981c
...
...
@@ -28,7 +28,7 @@ class Update
$message
=
isset
(
$data
[
'message'
])
?
$data
[
'message'
]
:
null
;
if
(
empty
(
$update_id
))
{
throw
new
Exception
(
'update_id is empty!'
);
throw
new
\
Exception
(
'update_id is empty!'
);
}
$this
->
update_id
=
$update_id
;
...
...
src/Entities/User.php
View file @
80c5981c
...
...
@@ -25,12 +25,12 @@ class User
$this
->
id
=
isset
(
$data
[
'id'
])
?
$data
[
'id'
]
:
null
;
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
;
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
;
...
...
src/Request.php
View file @
80c5981c
...
...
@@ -98,7 +98,7 @@ class Request
public
static
function
sendMessage
(
array
$data
)
{
if
(
empty
(
$data
))
{
throw
new
Exception
(
'Data is empty!'
);
throw
new
\
Exception
(
'Data is empty!'
);
}
$result
=
self
::
send
(
'sendMessage'
,
$data
);
...
...
src/Telegram.php
View file @
80c5981c
...
...
@@ -163,14 +163,14 @@ class Telegram
if
(
empty
(
$this
->
input
))
{
throw
new
Exception
(
'Input is empty!'
);
throw
new
\
Exception
(
'Input is empty!'
);
}
$post
=
json_decode
(
$this
->
input
,
true
);
if
(
empty
(
$post
))
{
throw
new
Exception
(
'Invalid JSON!'
);
throw
new
\
Exception
(
'Invalid JSON!'
);
}
...
...
@@ -230,7 +230,7 @@ class Telegram
*/
public
function
addCommandsPath
(
$folder
)
{
if
(
!
is_dir
(
$folder
))
{
throw
new
Exception
(
'Commands folder not exists!'
);
throw
new
\
Exception
(
'Commands folder not exists!'
);
}
$this
->
commands_dir
[]
=
$folder
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment