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
Hide 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
/**
* Telegram object
*
* @var Telegram
* @var
\Longman\TelegramBot\
Telegram
*/
protected
$telegram
;
...
...
@@ -90,7 +90,7 @@ abstract class Command
/**
* Constructor
*
* @param
Telegram
$telegram
* @param
\Longman\TelegramBot\Telegram
$telegram
* @param \Longman\TelegramBot\Entities\Update $update
*/
public
function
__construct
(
Telegram
$telegram
,
Update
$update
=
null
)
...
...
@@ -104,14 +104,16 @@ abstract class Command
* Set update object
*
* @param \Longman\TelegramBot\Entities\Update $update
* @return Command
*
* @return \Longman\TelegramBot\Commands\Command
*/
public
function
setUpdate
(
Update
$update
=
null
)
{
if
(
!
empty
(
$update
)
)
{
if
(
$update
!==
null
)
{
$this
->
update
=
$update
;
$this
->
message
=
$this
->
update
->
getMessage
();
}
return
$this
;
}
...
...
@@ -119,12 +121,14 @@ abstract class Command
* Pre-execute command
*
* @return \Longman\TelegramBot\Entities\ServerResponse
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public
function
preExecute
()
{
if
(
$this
->
need_mysql
&&
!
(
$this
->
telegram
->
isDbEnabled
()
&&
DB
::
isDbConnected
()))
{
return
$this
->
executeNoDb
();
}
return
$this
->
execute
();
}
...
...
@@ -132,6 +136,7 @@ abstract class Command
* Execute command
*
* @return \Longman\TelegramBot\Entities\ServerResponse
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
abstract
public
function
execute
();
...
...
@@ -139,6 +144,7 @@ abstract class Command
* Execution if MySQL is required but not available
*
* @return \Longman\TelegramBot\Entities\ServerResponse
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public
function
executeNoDb
()
{
...
...
@@ -182,7 +188,7 @@ abstract class Command
*
* @param string|null $name
*
* @return
mixed
* @return
array|mixed|null
*/
public
function
getConfig
(
$name
=
null
)
{
...
...
@@ -192,13 +198,14 @@ abstract class Command
if
(
isset
(
$this
->
config
[
$name
]))
{
return
$this
->
config
[
$name
];
}
return
null
;
}
/**
* Get telegram object
*
* @return Telegram
* @return
\Longman\TelegramBot\
Telegram
*/
public
function
getTelegram
()
{
...
...
@@ -248,7 +255,7 @@ abstract class Command
/**
* Check if command is enabled
*
* @return bool
ean
* @return bool
*/
public
function
isEnabled
()
{
...
...
src/Commands/SystemCommand.php
View file @
703bce70
...
...
@@ -24,7 +24,7 @@ abstract class SystemCommand extends Command
*/
public
function
execute
()
{
//System command, return empty ServerResponse
//System command, return empty ServerResponse
by default
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