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
703bce70
Unverified
Commit
703bce70
authored
Aug 26, 2016
by
Armando Lüscher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Various minor DocBlock corrections.
parent
2724f793
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
8 deletions
+15
-8
Command.php
src/Commands/Command.php
+14
-7
SystemCommand.php
src/Commands/SystemCommand.php
+1
-1
No files found.
src/Commands/Command.php
View file @
703bce70
...
@@ -20,7 +20,7 @@ abstract class Command
...
@@ -20,7 +20,7 @@ abstract class Command
/**
/**
* Telegram object
* Telegram object
*
*
* @var Telegram
* @var
\Longman\TelegramBot\
Telegram
*/
*/
protected
$telegram
;
protected
$telegram
;
...
@@ -90,7 +90,7 @@ abstract class Command
...
@@ -90,7 +90,7 @@ abstract class Command
/**
/**
* Constructor
* Constructor
*
*
* @param
Telegram
$telegram
* @param
\Longman\TelegramBot\Telegram
$telegram
* @param \Longman\TelegramBot\Entities\Update $update
* @param \Longman\TelegramBot\Entities\Update $update
*/
*/
public
function
__construct
(
Telegram
$telegram
,
Update
$update
=
null
)
public
function
__construct
(
Telegram
$telegram
,
Update
$update
=
null
)
...
@@ -104,14 +104,16 @@ abstract class Command
...
@@ -104,14 +104,16 @@ abstract class Command
* Set update object
* Set update object
*
*
* @param \Longman\TelegramBot\Entities\Update $update
* @param \Longman\TelegramBot\Entities\Update $update
* @return Command
*
* @return \Longman\TelegramBot\Commands\Command
*/
*/
public
function
setUpdate
(
Update
$update
=
null
)
public
function
setUpdate
(
Update
$update
=
null
)
{
{
if
(
!
empty
(
$update
)
)
{
if
(
$update
!==
null
)
{
$this
->
update
=
$update
;
$this
->
update
=
$update
;
$this
->
message
=
$this
->
update
->
getMessage
();
$this
->
message
=
$this
->
update
->
getMessage
();
}
}
return
$this
;
return
$this
;
}
}
...
@@ -119,12 +121,14 @@ abstract class Command
...
@@ -119,12 +121,14 @@ abstract class Command
* Pre-execute command
* Pre-execute command
*
*
* @return \Longman\TelegramBot\Entities\ServerResponse
* @return \Longman\TelegramBot\Entities\ServerResponse
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
*/
public
function
preExecute
()
public
function
preExecute
()
{
{
if
(
$this
->
need_mysql
&&
!
(
$this
->
telegram
->
isDbEnabled
()
&&
DB
::
isDbConnected
()))
{
if
(
$this
->
need_mysql
&&
!
(
$this
->
telegram
->
isDbEnabled
()
&&
DB
::
isDbConnected
()))
{
return
$this
->
executeNoDb
();
return
$this
->
executeNoDb
();
}
}
return
$this
->
execute
();
return
$this
->
execute
();
}
}
...
@@ -132,6 +136,7 @@ abstract class Command
...
@@ -132,6 +136,7 @@ abstract class Command
* Execute command
* Execute command
*
*
* @return \Longman\TelegramBot\Entities\ServerResponse
* @return \Longman\TelegramBot\Entities\ServerResponse
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
*/
abstract
public
function
execute
();
abstract
public
function
execute
();
...
@@ -139,6 +144,7 @@ abstract class Command
...
@@ -139,6 +144,7 @@ abstract class Command
* Execution if MySQL is required but not available
* Execution if MySQL is required but not available
*
*
* @return \Longman\TelegramBot\Entities\ServerResponse
* @return \Longman\TelegramBot\Entities\ServerResponse
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
*/
public
function
executeNoDb
()
public
function
executeNoDb
()
{
{
...
@@ -182,7 +188,7 @@ abstract class Command
...
@@ -182,7 +188,7 @@ abstract class Command
*
*
* @param string|null $name
* @param string|null $name
*
*
* @return
mixed
* @return
array|mixed|null
*/
*/
public
function
getConfig
(
$name
=
null
)
public
function
getConfig
(
$name
=
null
)
{
{
...
@@ -192,13 +198,14 @@ abstract class Command
...
@@ -192,13 +198,14 @@ abstract class Command
if
(
isset
(
$this
->
config
[
$name
]))
{
if
(
isset
(
$this
->
config
[
$name
]))
{
return
$this
->
config
[
$name
];
return
$this
->
config
[
$name
];
}
}
return
null
;
return
null
;
}
}
/**
/**
* Get telegram object
* Get telegram object
*
*
* @return Telegram
* @return
\Longman\TelegramBot\
Telegram
*/
*/
public
function
getTelegram
()
public
function
getTelegram
()
{
{
...
@@ -248,7 +255,7 @@ abstract class Command
...
@@ -248,7 +255,7 @@ abstract class Command
/**
/**
* Check if command is enabled
* Check if command is enabled
*
*
* @return bool
ean
* @return bool
*/
*/
public
function
isEnabled
()
public
function
isEnabled
()
{
{
...
...
src/Commands/SystemCommand.php
View file @
703bce70
...
@@ -24,7 +24,7 @@ abstract class SystemCommand extends Command
...
@@ -24,7 +24,7 @@ abstract class SystemCommand extends Command
*/
*/
public
function
execute
()
public
function
execute
()
{
{
//System command, return empty ServerResponse
//System command, return empty ServerResponse
by default
return
Request
::
emptyResponse
();
return
Request
::
emptyResponse
();
}
}
}
}
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