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
0b9e5172
Commit
0b9e5172
authored
Apr 21, 2017
by
Armando Lüscher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
When getting update content, get the Entity object instead of an array.
Some tiny code fixes.
parent
5a62e3b7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
5 deletions
+7
-5
GenericCommand.php
src/Commands/SystemCommands/GenericCommand.php
+1
-1
Entity.php
src/Entities/Entity.php
+2
-3
Update.php
src/Entities/Update.php
+4
-1
No files found.
src/Commands/SystemCommands/GenericCommand.php
View file @
0b9e5172
...
...
@@ -45,7 +45,7 @@ class GenericCommand extends SystemCommand
//$chat_id = $message->getChat()->getId();
//$user_id = $message->getFrom()->getId();
//$command = $message->getCommand();
//
#
text = trim($message->getText(true));
//
$
text = trim($message->getText(true));
return
parent
::
execute
();
}
...
...
src/Entities/Entity.php
View file @
0b9e5172
...
...
@@ -13,7 +13,6 @@ namespace Longman\TelegramBot\Entities;
use
Exception
;
use
Longman\TelegramBot\Entities\InlineQuery\InlineEntity
;
use
Longman\TelegramBot\TelegramLog
;
use
ReflectionObject
;
/**
* Class Entity
...
...
@@ -132,7 +131,7 @@ abstract class Entity
public
function
__call
(
$method
,
$args
)
{
//Convert method to snake_case (which is the name of the property)
$property_name
=
ltrim
(
strtolower
(
preg_replace
(
'/[A-Z]/'
,
'_$0'
,
substr
(
$method
,
3
))),
'_'
);
$property_name
=
strtolower
(
ltrim
(
preg_replace
(
'/[A-Z]/'
,
'_$0'
,
substr
(
$method
,
3
)),
'_'
)
);
$action
=
substr
(
$method
,
0
,
3
);
if
(
$action
===
'get'
)
{
...
...
@@ -224,7 +223,7 @@ abstract class Entity
}
//Try with the username first...
$name
=
$this
->
getProperty
(
'username'
);
$name
=
$this
->
getProperty
(
'username'
);
$is_username
=
$name
!==
null
;
if
(
$name
===
null
)
{
...
...
src/Entities/Update.php
View file @
0b9e5172
...
...
@@ -78,7 +78,10 @@ class Update extends Entity
public
function
getUpdateContent
()
{
if
(
$update_type
=
$this
->
getUpdateType
())
{
return
$this
->
getProperty
(
$update_type
);
// Instead of just getting the property as an array,
// use the __call method to get the correct Entity object.
$method
=
'get'
.
str_replace
(
'_'
,
''
,
ucwords
(
$update_type
,
'_'
));
return
$this
->
$method
();
}
return
null
;
...
...
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