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
b2ca6ae5
Unverified
Commit
b2ca6ae5
authored
Jun 13, 2019
by
Armando Lüscher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix and simplify dockblocks by removing unnecessary fully qualified class names.
parent
e4fcfa79
Changes
26
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
155 additions
and
138 deletions
+155
-138
ChatsCommand.php
src/Commands/AdminCommands/ChatsCommand.php
+4
-2
CleanupCommand.php
src/Commands/AdminCommands/CleanupCommand.php
+4
-3
DebugCommand.php
src/Commands/AdminCommands/DebugCommand.php
+2
-1
SendtoallCommand.php
src/Commands/AdminCommands/SendtoallCommand.php
+3
-2
SendtochannelCommand.php
src/Commands/AdminCommands/SendtochannelCommand.php
+14
-12
WhoisCommand.php
src/Commands/AdminCommands/WhoisCommand.php
+4
-2
Command.php
src/Commands/Command.php
+20
-18
SystemCommand.php
src/Commands/SystemCommand.php
+2
-1
GenericCommand.php
src/Commands/SystemCommands/GenericCommand.php
+2
-1
GenericmessageCommand.php
src/Commands/SystemCommands/GenericmessageCommand.php
+5
-3
Conversation.php
src/Conversation.php
+5
-3
Game.php
src/Entities/Games/Game.php
+2
-2
Keyboard.php
src/Entities/Keyboard.php
+4
-4
PreCheckoutQuery.php
src/Entities/Payments/PreCheckoutQuery.php
+2
-1
ShippingQuery.php
src/Entities/Payments/ShippingQuery.php
+2
-1
ServerResponse.php
src/Entities/ServerResponse.php
+2
-2
Update.php
src/Entities/Update.php
+1
-4
Request.php
src/Request.php
+18
-18
Telegram.php
src/Telegram.php
+30
-30
TelegramLog.php
src/TelegramLog.php
+10
-10
CommandTest.php
tests/unit/Commands/CommandTest.php
+5
-5
CommandTestCase.php
tests/unit/Commands/CommandTestCase.php
+3
-2
ConversationTest.php
tests/unit/ConversationTest.php
+1
-1
ServerResponseTest.php
tests/unit/Entities/ServerResponseTest.php
+4
-4
TelegramTest.php
tests/unit/TelegramTest.php
+1
-1
TestHelpers.php
tests/unit/TestHelpers.php
+5
-5
No files found.
src/Commands/AdminCommands/ChatsCommand.php
View file @
b2ca6ae5
...
...
@@ -13,6 +13,8 @@ namespace Longman\TelegramBot\Commands\AdminCommands;
use
Longman\TelegramBot\Commands\AdminCommand
;
use
Longman\TelegramBot\DB
;
use
Longman\TelegramBot\Entities\Chat
;
use
Longman\TelegramBot\Entities\ServerResponse
;
use
Longman\TelegramBot\Exception\TelegramException
;
use
Longman\TelegramBot\Request
;
class
ChatsCommand
extends
AdminCommand
...
...
@@ -45,8 +47,8 @@ class ChatsCommand extends AdminCommand
/**
* Command execute method
*
* @return
\Longman\TelegramBot\Entities\
ServerResponse
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @return ServerResponse
* @throws TelegramException
*/
public
function
execute
()
{
...
...
src/Commands/AdminCommands/CleanupCommand.php
View file @
b2ca6ae5
...
...
@@ -12,6 +12,7 @@ namespace Longman\TelegramBot\Commands\AdminCommands;
use
Longman\TelegramBot\Commands\AdminCommand
;
use
Longman\TelegramBot\DB
;
use
Longman\TelegramBot\Entities\ServerResponse
;
use
Longman\TelegramBot\Exception\TelegramException
;
use
Longman\TelegramBot\Request
;
use
Longman\TelegramBot\TelegramLog
;
...
...
@@ -338,7 +339,7 @@ class CleanupCommand extends AdminCommand
/**
* Execution if MySQL is required but not available
*
* @return
\Longman\TelegramBot\Entities\
ServerResponse
* @return ServerResponse
* @throws TelegramException
*/
public
function
executeNoDb
()
...
...
@@ -358,8 +359,8 @@ class CleanupCommand extends AdminCommand
/**
* Command execute method
*
* @return
\Longman\TelegramBot\Entities\
ServerResponse
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @return ServerResponse
* @throws TelegramException
*/
public
function
execute
()
{
...
...
src/Commands/AdminCommands/DebugCommand.php
View file @
b2ca6ae5
...
...
@@ -12,6 +12,7 @@ namespace Longman\TelegramBot\Commands\AdminCommands;
use
Longman\TelegramBot\Commands\AdminCommand
;
use
Longman\TelegramBot\DB
;
use
Longman\TelegramBot\Exception\TelegramException
;
use
Longman\TelegramBot\Request
;
/**
...
...
@@ -43,7 +44,7 @@ class DebugCommand extends AdminCommand
* Command execute method
*
* @return mixed
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @throws TelegramException
*/
public
function
execute
()
{
...
...
src/Commands/AdminCommands/SendtoallCommand.php
View file @
b2ca6ae5
...
...
@@ -13,6 +13,7 @@ namespace Longman\TelegramBot\Commands\AdminCommands;
use
Longman\TelegramBot\Commands\AdminCommand
;
use
Longman\TelegramBot\Entities\Message
;
use
Longman\TelegramBot\Entities\ServerResponse
;
use
Longman\TelegramBot\Exception\TelegramException
;
use
Longman\TelegramBot\Request
;
/**
...
...
@@ -48,8 +49,8 @@ class SendtoallCommand extends AdminCommand
/**
* Execute command
*
* @return
\Longman\TelegramBot\Entities\
ServerResponse
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @return ServerResponse
* @throws TelegramException
*/
public
function
execute
()
{
...
...
src/Commands/AdminCommands/SendtochannelCommand.php
View file @
b2ca6ae5
...
...
@@ -15,6 +15,8 @@ use Longman\TelegramBot\Conversation;
use
Longman\TelegramBot\Entities\Chat
;
use
Longman\TelegramBot\Entities\Keyboard
;
use
Longman\TelegramBot\Entities\Message
;
use
Longman\TelegramBot\Entities\ServerResponse
;
use
Longman\TelegramBot\Exception\TelegramException
;
use
Longman\TelegramBot\Request
;
class
SendtochannelCommand
extends
AdminCommand
...
...
@@ -47,15 +49,15 @@ class SendtochannelCommand extends AdminCommand
/**
* Conversation Object
*
* @var
\Longman\TelegramBot\
Conversation
* @var Conversation
*/
protected
$conversation
;
/**
* Command execute method
*
* @return
\Longman\TelegramBot\Entities\
ServerResponse|mixed
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @return ServerResponse|mixed
* @throws TelegramException
*/
public
function
execute
()
{
...
...
@@ -272,11 +274,11 @@ class SendtochannelCommand extends AdminCommand
* @todo This method will be moved to a higher level maybe in AdminCommand or Command
* @todo Looking for a more significant name
*
* @param
\Longman\TelegramBot\Entities\
Message $message
* @param array
$data
* @param Message $message
* @param array $data
*
* @return
\Longman\TelegramBot\Entities\
ServerResponse
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @return ServerResponse
* @throws TelegramException
*/
protected
function
sendBack
(
Message
$message
,
array
$data
)
{
...
...
@@ -311,12 +313,12 @@ class SendtochannelCommand extends AdminCommand
/**
* Publish a message to a channel and return success or failure message in markdown format
*
* @param
\Longman\TelegramBot\Entities\Message
$message
* @param string|int
$channel_id
* @param string|null
$caption
* @param
Message
$message
* @param string|int $channel_id
* @param string|null $caption
*
* @return string
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @throws TelegramException
*/
protected
function
publish
(
Message
$message
,
$channel_id
,
$caption
=
null
)
{
...
...
@@ -351,7 +353,7 @@ class SendtochannelCommand extends AdminCommand
* @todo Why send just to the first found channel?
*
* @return mixed
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @throws TelegramException
*/
public
function
executeNoDb
()
{
...
...
src/Commands/AdminCommands/WhoisCommand.php
View file @
b2ca6ae5
...
...
@@ -16,7 +16,9 @@ use Longman\TelegramBot\Commands\AdminCommand;
use
Longman\TelegramBot\DB
;
use
Longman\TelegramBot\Entities\Chat
;
use
Longman\TelegramBot\Entities\PhotoSize
;
use
Longman\TelegramBot\Entities\ServerResponse
;
use
Longman\TelegramBot\Entities\UserProfilePhotos
;
use
Longman\TelegramBot\Exception\TelegramException
;
use
Longman\TelegramBot\Request
;
/**
...
...
@@ -52,8 +54,8 @@ class WhoisCommand extends AdminCommand
/**
* Command execute method
*
* @return
\Longman\TelegramBot\Entities\
ServerResponse
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @return ServerResponse
* @throws TelegramException
*/
public
function
execute
()
{
...
...
src/Commands/Command.php
View file @
b2ca6ae5
...
...
@@ -18,7 +18,9 @@ use Longman\TelegramBot\Entities\Message;
use
Longman\TelegramBot\Entities\Payments\PreCheckoutQuery
;
use
Longman\TelegramBot\Entities\Payments\ShippingQuery
;
use
Longman\TelegramBot\Entities\Poll
;
use
Longman\TelegramBot\Entities\ServerResponse
;
use
Longman\TelegramBot\Entities\Update
;
use
Longman\TelegramBot\Exception\TelegramException
;
use
Longman\TelegramBot\Request
;
use
Longman\TelegramBot\Telegram
;
...
...
@@ -43,14 +45,14 @@ abstract class Command
/**
* Telegram object
*
* @var
\Longman\TelegramBot\
Telegram
* @var Telegram
*/
protected
$telegram
;
/**
* Update object
*
* @var
\Longman\TelegramBot\Entities\
Update
* @var Update
*/
protected
$update
;
...
...
@@ -120,8 +122,8 @@ abstract class Command
/**
* Constructor
*
* @param
\Longman\TelegramBot\Telegram
$telegram
* @param
\Longman\TelegramBot\Entities\Update
$update
* @param
Telegram
$telegram
* @param
Update
$update
*/
public
function
__construct
(
Telegram
$telegram
,
Update
$update
=
null
)
{
...
...
@@ -133,9 +135,9 @@ abstract class Command
/**
* Set update object
*
* @param
\Longman\TelegramBot\Entities\
Update $update
* @param Update $update
*
* @return
\Longman\TelegramBot\Commands\
Command
* @return Command
*/
public
function
setUpdate
(
Update
$update
=
null
)
{
...
...
@@ -149,8 +151,8 @@ abstract class Command
/**
* Pre-execute command
*
* @return
\Longman\TelegramBot\Entities\
ServerResponse
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @return ServerResponse
* @throws TelegramException
*/
public
function
preExecute
()
{
...
...
@@ -182,16 +184,16 @@ abstract class Command
/**
* Execute command
*
* @return
\Longman\TelegramBot\Entities\
ServerResponse
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @return ServerResponse
* @throws TelegramException
*/
abstract
public
function
execute
();
/**
* Execution if MySQL is required but not available
*
* @return
\Longman\TelegramBot\Entities\
ServerResponse
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @return ServerResponse
* @throws TelegramException
*/
public
function
executeNoDb
()
{
...
...
@@ -210,7 +212,7 @@ abstract class Command
/**
* Get update object
*
* @return
\Longman\TelegramBot\Entities\
Update
* @return Update
*/
public
function
getUpdate
()
{
...
...
@@ -260,7 +262,7 @@ abstract class Command
/**
* Get telegram object
*
* @return
\Longman\TelegramBot\
Telegram
* @return Telegram
*/
public
function
getTelegram
()
{
...
...
@@ -399,8 +401,8 @@ abstract class Command
* @param string $text
* @param array $data
*
* @return
\Longman\TelegramBot\Entities\
ServerResponse
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @return ServerResponse
* @throws TelegramException
*/
public
function
replyToChat
(
$text
,
array
$data
=
[])
{
...
...
@@ -420,8 +422,8 @@ abstract class Command
* @param string $text
* @param array $data
*
* @return
\Longman\TelegramBot\Entities\
ServerResponse
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @return ServerResponse
* @throws TelegramException
*/
public
function
replyToUser
(
$text
,
array
$data
=
[])
{
...
...
src/Commands/SystemCommand.php
View file @
b2ca6ae5
...
...
@@ -10,6 +10,7 @@
namespace
Longman\TelegramBot\Commands
;
use
Longman\TelegramBot\Entities\ServerResponse
;
use
Longman\TelegramBot\Request
;
abstract
class
SystemCommand
extends
Command
...
...
@@ -20,7 +21,7 @@ abstract class SystemCommand extends Command
* Although system commands should just work and return a successful ServerResponse,
* each system command can override this method to add custom functionality.
*
* @return
\Longman\TelegramBot\Entities\
ServerResponse
* @return ServerResponse
*/
public
function
execute
()
{
...
...
src/Commands/SystemCommands/GenericCommand.php
View file @
b2ca6ae5
...
...
@@ -11,6 +11,7 @@
namespace
Longman\TelegramBot\Commands\SystemCommands
;
use
Longman\TelegramBot\Commands\SystemCommand
;
use
Longman\TelegramBot\Entities\ServerResponse
;
/**
* Generic command
...
...
@@ -35,7 +36,7 @@ class GenericCommand extends SystemCommand
/**
* Command execute method
*
* @return
\Longman\TelegramBot\Entities\
ServerResponse
* @return ServerResponse
*/
public
function
execute
()
{
...
...
src/Commands/SystemCommands/GenericmessageCommand.php
View file @
b2ca6ae5
...
...
@@ -12,6 +12,8 @@ namespace Longman\TelegramBot\Commands\SystemCommands;
use
Longman\TelegramBot\Commands\SystemCommand
;
use
Longman\TelegramBot\Conversation
;
use
Longman\TelegramBot\Entities\ServerResponse
;
use
Longman\TelegramBot\Exception\TelegramException
;
use
Longman\TelegramBot\Request
;
/**
...
...
@@ -42,7 +44,7 @@ class GenericmessageCommand extends SystemCommand
/**
* Execution if MySQL is required but not available
*
* @return
\Longman\TelegramBot\Entities\
ServerResponse
* @return ServerResponse
*/
public
function
executeNoDb
()
{
...
...
@@ -53,8 +55,8 @@ class GenericmessageCommand extends SystemCommand
/**
* Execute command
*
* @return
\Longman\TelegramBot\Entities\
ServerResponse
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @return ServerResponse
* @throws TelegramException
*/
public
function
execute
()
{
...
...
src/Conversation.php
View file @
b2ca6ae5
...
...
@@ -10,6 +10,8 @@
namespace
Longman\TelegramBot
;
use
Longman\TelegramBot\Exception\TelegramException
;
/**
* Class Conversation
*
...
...
@@ -67,7 +69,7 @@ class Conversation
* @param int $chat_id
* @param string $command
*
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @throws TelegramException
*/
public
function
__construct
(
$user_id
,
$chat_id
,
$command
=
null
)
{
...
...
@@ -100,7 +102,7 @@ class Conversation
* Load the conversation from the database
*
* @return bool
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @throws TelegramException
*/
protected
function
load
()
{
...
...
@@ -140,7 +142,7 @@ class Conversation
* Start a new conversation if the current command doesn't have one yet
*
* @return bool
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @throws TelegramException
*/
protected
function
start
()
{
...
...
src/Entities/Games/Game.php
View file @
b2ca6ae5
...
...
@@ -47,7 +47,7 @@ class Game extends Entity
* This method overrides the default getPhoto method
* and returns a nice array of PhotoSize objects.
*
* @return null|
\Longman\TelegramBot\Entities\
PhotoSize[]
* @return null|PhotoSize[]
*/
public
function
getPhoto
()
{
...
...
@@ -62,7 +62,7 @@ class Game extends Entity
* This method overrides the default getTextEntities method
* and returns a nice array of MessageEntity objects.
*
* @return null|
\Longman\TelegramBot\Entities\
MessageEntity[]
* @return null|MessageEntity[]
*/
public
function
getTextEntities
()
{
...
...
src/Entities/Keyboard.php
View file @
b2ca6ae5
...
...
@@ -154,9 +154,9 @@ class Keyboard extends Entity
/**
* Parse a given button to the correct KeyboardButton object type.
*
* @param array|string|
\Longman\TelegramBot\Entities\
KeyboardButton $button
* @param array|string|KeyboardButton $button
*
* @return
\Longman\TelegramBot\Entities\
KeyboardButton|null
* @return KeyboardButton|null
*/
protected
function
parseButton
(
$button
)
{
...
...
@@ -201,7 +201,7 @@ class Keyboard extends Entity
*
* @param array $data
*
* @return
\Longman\TelegramBot\Entities\
Keyboard
* @return Keyboard
*/
public
static
function
remove
(
array
$data
=
[])
{
...
...
@@ -215,7 +215,7 @@ class Keyboard extends Entity
*
* @param array $data
*
* @return
\Longman\TelegramBot\Entities\
Keyboard
* @return Keyboard
*/
public
static
function
forceReply
(
array
$data
=
[])
{
...
...
src/Entities/Payments/PreCheckoutQuery.php
View file @
b2ca6ae5
...
...
@@ -11,6 +11,7 @@
namespace
Longman\TelegramBot\Entities\Payments
;
use
Longman\TelegramBot\Entities\Entity
;
use
Longman\TelegramBot\Entities\ServerResponse
;
use
Longman\TelegramBot\Entities\User
;
use
Longman\TelegramBot\Request
;
...
...
@@ -48,7 +49,7 @@ class PreCheckoutQuery extends Entity
* @param bool $ok
* @param array $data
*
* @return
\Longman\TelegramBot\Entities\
ServerResponse
* @return ServerResponse
*/
public
function
answer
(
$ok
,
array
$data
=
[])
{
...
...
src/Entities/Payments/ShippingQuery.php
View file @
b2ca6ae5
...
...
@@ -11,6 +11,7 @@
namespace
Longman\TelegramBot\Entities\Payments
;
use
Longman\TelegramBot\Entities\Entity
;
use
Longman\TelegramBot\Entities\ServerResponse
;
use
Longman\TelegramBot\Entities\User
;
use
Longman\TelegramBot\Request
;
...
...
@@ -45,7 +46,7 @@ class ShippingQuery extends Entity
* @param bool $ok
* @param array $data
*
* @return
\Longman\TelegramBot\Entities\
ServerResponse
* @return ServerResponse
*/
public
function
answer
(
$ok
,
array
$data
=
[])
{
...
...
src/Entities/ServerResponse.php
View file @
b2ca6ae5
...
...
@@ -103,7 +103,7 @@ class ServerResponse extends Entity
* @param array $result
* @param string $bot_username
*
* @return
\Longman\TelegramBot\Entities\Chat|\Longman\TelegramBot\Entities\ChatMember|\Longman\TelegramBot\Entities\File|\Longman\TelegramBot\Entities\Message|\Longman\TelegramBot\Entities\User|\Longman\TelegramBot\Entities\UserProfilePhotos|\Longman\TelegramBot\Entities\
WebhookInfo
* @return
Chat|ChatMember|File|Message|User|UserProfilePhotos|
WebhookInfo
*/
private
function
createResultObject
(
array
$result
,
$bot_username
)
{
...
...
@@ -133,7 +133,7 @@ class ServerResponse extends Entity
* @param array $result
* @param string $bot_username
*
* @return
\Longman\TelegramBot\Entities\ChatMember[]|\Longman\TelegramBot\Entities\Games\GameHighScore[]|\Longman\TelegramBot\Entities\Message[]|\Longman\TelegramBot\Entities\
Update[]
* @return
ChatMember[]|GameHighScore[]|Message[]|
Update[]
*/
private
function
createResultObjects
(
array
$result
,
$bot_username
)
{
...
...
src/Entities/Update.php
View file @
b2ca6ae5
...
...
@@ -82,10 +82,7 @@ class Update extends Entity
/**
* Get update content
*
* @return \Longman\TelegramBot\Entities\CallbackQuery
* |\Longman\TelegramBot\Entities\ChosenInlineResult
* |\Longman\TelegramBot\Entities\InlineQuery
* |\Longman\TelegramBot\Entities\Message
* @return CallbackQuery|ChosenInlineResult|InlineQuery|Message
*/
public
function
getUpdateContent
()
{
...
...
src/Request.php
View file @
b2ca6ae5
...
...
@@ -91,7 +91,7 @@ class Request
/**
* Telegram object
*
* @var
\Longman\TelegramBot\
Telegram
* @var Telegram
*/
private
static
$telegram
;
...
...
@@ -105,7 +105,7 @@ class Request
/**
* Guzzle Client object
*
* @var
\GuzzleHttp\
Client
* @var Client
*/
private
static
$client
;
...
...
@@ -253,7 +253,7 @@ class Request
/**
* Initialize
*
* @param
\Longman\TelegramBot\
Telegram $telegram
* @param Telegram $telegram
*
* @throws TelegramException
*/
...
...
@@ -287,7 +287,7 @@ class Request
* Set input from custom input or stdin and return it
*
* @return string
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @throws TelegramException
*/
public
static
function
getInput
()
{
...
...
@@ -473,7 +473,7 @@ class Request
* @param array $data Data to attach to the execution
*
* @return string Result of the HTTP Request
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @throws TelegramException
*/
public
static
function
execute
(
$action
,
array
$data
=
[])
{
...
...
@@ -510,10 +510,10 @@ class Request
/**
* Download file
*
* @param
\Longman\TelegramBot\Entities\
File $file
* @param File $file
*
* @return boolean
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @throws TelegramException
*/
public
static
function
downloadFile
(
File
$file
)
{
...
...
@@ -554,7 +554,7 @@ class Request
* @param string $file
*
* @return resource
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @throws TelegramException
*/
public
static
function
encodeFile
(
$file
)
{
...
...
@@ -575,8 +575,8 @@ class Request
* @param string $action
* @param array $data
*
* @return
\Longman\TelegramBot\Entities\
ServerResponse
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @return ServerResponse
* @throws TelegramException
*/
public
static
function
send
(
$action
,
array
$data
=
[])
{
...
...
@@ -644,7 +644,7 @@ class Request
*
* @param array $data
*
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @throws TelegramException
*/
private
static
function
ensureNonEmptyData
(
array
$data
)
{
...
...
@@ -658,7 +658,7 @@ class Request
*
* @param string $action
*
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @throws TelegramException
*/
private
static
function
ensureValidAction
(
$action
)
{
...
...
@@ -674,8 +674,8 @@ class Request
*
* @param array $data
*
* @return
\Longman\TelegramBot\Entities\
ServerResponse
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @return ServerResponse
* @throws TelegramException
*/
public
static
function
sendMessage
(
array
$data
)
{
...
...
@@ -699,7 +699,7 @@ class Request
* @param string $action
* @param array $data
*
* @return
\Longman\TelegramBot\Entities\
ServerResponse
* @return ServerResponse
*/
public
static
function
__callStatic
(
$action
,
array
$data
)
{
...
...
@@ -716,7 +716,7 @@ class Request
* No request to telegram are sent, this function is used in commands that
* don't need to fire a message after execution
*
* @return
\Longman\TelegramBot\Entities\
ServerResponse
* @return ServerResponse
*/
public
static
function
emptyResponse
()
{
...
...
@@ -759,7 +759,7 @@ class Request
* @param boolean $enable
* @param array $options
*
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @throws TelegramException
*/
public
static
function
setLimiter
(
$enable
=
true
,
array
$options
=
[])
{
...
...
@@ -788,7 +788,7 @@ class Request
* @param string $action
* @param array $data
*
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @throws TelegramException
*/
private
static
function
limitTelegramRequests
(
$action
,
array
$data
=
[])
{
...
...
src/Telegram.php
View file @
b2ca6ae5
...
...
@@ -70,7 +70,7 @@ class Telegram
/**
* Current Update object
*
* @var
\Longman\TelegramBot\Entities\
Update
* @var Update
*/
protected
$update
;
...
...
@@ -98,7 +98,7 @@ class Telegram
/**
* PDO object
*
* @var
\
PDO
* @var PDO
*/
protected
$pdo
;
...
...
@@ -119,7 +119,7 @@ class Telegram
/**
* ServerResponse of the last Command execution
*
* @var
\Longman\TelegramBot\Entities\
ServerResponse
* @var ServerResponse
*/
protected
$last_command_response
;
...
...
@@ -151,7 +151,7 @@ class Telegram
* @param string $api_key
* @param string $bot_username
*
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @throws TelegramException
*/
public
function
__construct
(
$api_key
,
$bot_username
=
''
)
{
...
...
@@ -182,8 +182,8 @@ class Telegram
* @param string $table_prefix
* @param string $encoding
*
* @return
\Longman\TelegramBot\
Telegram
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @return Telegram
* @throws TelegramException
*/
public
function
enableMySql
(
array
$credential
,
$table_prefix
=
null
,
$encoding
=
'utf8mb4'
)
{
...
...
@@ -200,8 +200,8 @@ class Telegram
* @param PDO $external_pdo_connection PDO database object
* @param string $table_prefix
*
* @return
\Longman\TelegramBot\
Telegram
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @return Telegram
* @throws TelegramException
*/
public
function
enableExternalMySql
(
$external_pdo_connection
,
$table_prefix
=
null
)
{
...
...
@@ -216,7 +216,7 @@ class Telegram
* Get commands list
*
* @return array $commands
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @throws TelegramException
*/
public
function
getCommandsList
()
{
...
...
@@ -261,7 +261,7 @@ class Telegram
*
* @param string $command
*
* @return
\Longman\TelegramBot\Commands\
Command|null
* @return Command|null
*/
public
function
getCommandObject
(
$command
)
{
...
...
@@ -284,7 +284,7 @@ class Telegram
*
* @param string $input (json format)
*
* @return
\Longman\TelegramBot\
Telegram
* @return Telegram
*/
public
function
setCustomInput
(
$input
)
{
...
...
@@ -306,7 +306,7 @@ class Telegram
/**
* Get the ServerResponse of the last Command execution
*
* @return
\Longman\TelegramBot\Entities\
ServerResponse
* @return ServerResponse
*/
public
function
getLastCommandResponse
()
{
...
...
@@ -319,8 +319,8 @@ class Telegram
* @param int|null $limit
* @param int|null $timeout
*
* @return
\Longman\TelegramBot\Entities\
ServerResponse
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @return ServerResponse
* @throws TelegramException
*/
public
function
handleGetUpdates
(
$limit
=
null
,
$timeout
=
null
)
{
...
...
@@ -394,7 +394,7 @@ class Telegram
*
* @return bool
*
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @throws TelegramException
*/
public
function
handle
()
{
...
...
@@ -435,10 +435,10 @@ class Telegram
/**
* Process bot Update request
*
* @param
\Longman\TelegramBot\Entities\
Update $update
* @param Update $update
*
* @return
\Longman\TelegramBot\Entities\
ServerResponse
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @return ServerResponse
* @throws TelegramException
*/
public
function
processUpdate
(
Update
$update
)
{
...
...
@@ -493,7 +493,7 @@ class Telegram
* @param string $command
*
* @return mixed
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @throws TelegramException
*/
public
function
executeCommand
(
$command
)
{
...
...
@@ -534,7 +534,7 @@ class Telegram
*
* @param integer $admin_id Single admin id
*
* @return
\Longman\TelegramBot\
Telegram
* @return Telegram
*/
public
function
enableAdmin
(
$admin_id
)
{
...
...
@@ -552,7 +552,7 @@ class Telegram
*
* @param array $admin_ids List of admin ids
*
* @return
\Longman\TelegramBot\
Telegram
* @return Telegram
*/
public
function
enableAdmins
(
array
$admin_ids
)
{
...
...
@@ -627,7 +627,7 @@ class Telegram
* @param string $path Custom commands path to add
* @param bool $before If the path should be prepended or appended to the list
*
* @return
\Longman\TelegramBot\
Telegram
* @return Telegram
*/
public
function
addCommandsPath
(
$path
,
$before
=
true
)
{
...
...
@@ -650,7 +650,7 @@ class Telegram
* @param array $paths Custom commands paths to add
* @param bool $before If the paths should be prepended or appended to the list
*
* @return
\Longman\TelegramBot\
Telegram
* @return Telegram
*/
public
function
addCommandsPaths
(
array
$paths
,
$before
=
true
)
{
...
...
@@ -676,7 +676,7 @@ class Telegram
*
* @param string $path Custom upload path
*
* @return
\Longman\TelegramBot\
Telegram
* @return Telegram
*/
public
function
setUploadPath
(
$path
)
{
...
...
@@ -700,7 +700,7 @@ class Telegram
*
* @param string $path Custom download path
*
* @return
\Longman\TelegramBot\
Telegram
* @return Telegram
*/
public
function
setDownloadPath
(
$path
)
{
...
...
@@ -729,7 +729,7 @@ class Telegram
* @param string $command
* @param array $config
*
* @return
\Longman\TelegramBot\
Telegram
* @return Telegram
*/
public
function
setCommandConfig
(
$command
,
array
$config
)
{
...
...
@@ -796,8 +796,8 @@ class Telegram
* @param string $url
* @param array $data Optional parameters.
*
* @return
\Longman\TelegramBot\Entities\
ServerResponse
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @return ServerResponse
* @throws TelegramException
*/
public
function
setWebhook
(
$url
,
array
$data
=
[])
{
...
...
@@ -832,7 +832,7 @@ class Telegram
* Delete any assigned webhook
*
* @return mixed
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @throws TelegramException
*/
public
function
deleteWebhook
()
{
...
...
@@ -879,7 +879,7 @@ class Telegram
*
* @param array $options
*
* @return
\Longman\TelegramBot\
Telegram
* @return Telegram
* @throws TelegramException
*/
public
function
enableLimiter
(
array
$options
=
[])
...
...
src/TelegramLog.php
View file @
b2ca6ae5
...
...
@@ -20,14 +20,14 @@ class TelegramLog
/**
* Monolog instance
*
* @var
\Monolog\
Logger
* @var Logger
*/
protected
static
$monolog
;
/**
* Monolog instance for update
*
* @var
\Monolog\
Logger
* @var Logger
*/
protected
static
$monolog_update
;
...
...
@@ -62,9 +62,9 @@ class TelegramLog
/**
* Initialize Monolog Logger instance, optionally passing an existing one
*
* @param
\Monolog\
Logger
* @param Logger
*
* @return
\Monolog\
Logger
* @return Logger
*/
public
static
function
initialize
(
Logger
$external_monolog
=
null
)
{
...
...
@@ -93,8 +93,8 @@ class TelegramLog
*
* @param string $path
*
* @return
\Monolog\
Logger
* @throws
\Longman\TelegramBot\Exception\
TelegramLogException
* @return Logger
* @throws TelegramLogException
* @throws \InvalidArgumentException
* @throws \Exception
*/
...
...
@@ -117,8 +117,8 @@ class TelegramLog
*
* @param string $path
*
* @return
\Monolog\
Logger
* @throws
\Longman\TelegramBot\Exception\
TelegramLogException
* @return Logger
* @throws TelegramLogException
* @throws \InvalidArgumentException
* @throws \Exception
*/
...
...
@@ -173,8 +173,8 @@ class TelegramLog
*
* @param string $path
*
* @return
\Monolog\
Logger
* @throws
\Longman\TelegramBot\Exception\
TelegramLogException
* @return Logger
* @throws TelegramLogException
* @throws \InvalidArgumentException
* @throws \Exception
*/
...
...
tests/unit/Commands/CommandTest.php
View file @
b2ca6ae5
...
...
@@ -10,10 +10,10 @@
namespace
Longman\TelegramBot\Tests\Unit\Commands
;
use
Longman\TelegramBot\Commands\Command
;
use
Longman\TelegramBot\Telegram
;
use
Longman\TelegramBot\Tests\Unit\TestCase
;
use
Longman\TelegramBot\Tests\Unit\TestHelpers
;
use
Longman\TelegramBot\Commands\Command
;
/**
* @package TelegramTest
...
...
@@ -30,22 +30,22 @@ class CommandTest extends TestCase
private
$command_namespace
=
Command
::
class
;
/**
* @var
\Longman\TelegramBot\
Telegram
* @var Telegram
*/
private
$telegram
;
/**
* @var
\Longman\TelegramBot\Commands\
Command
* @var Command
*/
private
$command_stub
;
/**
* @var
\Longman\TelegramBot\
Telegram
* @var Telegram
*/
private
$telegram_with_config
;
/**
* @var
\Longman\TelegramBot\Commands\
Command
* @var Command
*/
private
$command_stub_with_config
;
...
...
tests/unit/Commands/CommandTestCase.php
View file @
b2ca6ae5
...
...
@@ -10,6 +10,7 @@
namespace
Longman\TelegramBot\Tests\Unit\Commands
;
use
Longman\TelegramBot\Commands\Command
;
use
Longman\TelegramBot\Telegram
;
use
Longman\TelegramBot\Tests\Unit\TestCase
;
...
...
@@ -23,12 +24,12 @@ use Longman\TelegramBot\Tests\Unit\TestCase;
class
CommandTestCase
extends
TestCase
{
/**
* @var
\Longman\TelegramBot\
Telegram
* @var Telegram
*/
protected
$telegram
;
/**
* @var
\Longman\TelegramBot\Commands\
Command
* @var Command
*/
protected
$command
;
...
...
tests/unit/ConversationTest.php
View file @
b2ca6ae5
...
...
@@ -23,7 +23,7 @@ use Longman\TelegramBot\Telegram;
class
ConversationTest
extends
TestCase
{
/**
* @var
\Longman\TelegramBot\
Telegram
* @var Telegram
*/
private
$telegram
;
...
...
tests/unit/Entities/ServerResponseTest.php
View file @
b2ca6ae5
...
...
@@ -12,15 +12,15 @@
namespace
Longman\TelegramBot\Tests\Unit
;
use
Longman\TelegramBot\Entities\File
;
use
Longman\TelegramBot\Entities\Message
;
use
Longman\TelegramBot\Entities\PhotoSize
;
use
Longman\TelegramBot\Entities\ServerResponse
;
use
Longman\TelegramBot\Request
;
use
Longman\TelegramBot\Entities\Sticker
;
use
Longman\TelegramBot\Entities\StickerSet
;
use
Longman\TelegramBot\Entities\File
;
use
Longman\TelegramBot\Entities\PhotoSize
;
use
Longman\TelegramBot\Entities\UserProfilePhotos
;
use
Longman\TelegramBot\Entities\Update
;
use
Longman\TelegramBot\Entities\UserProfilePhotos
;
use
Longman\TelegramBot\Request
;
/**
* @package TelegramTest
...
...
tests/unit/TelegramTest.php
View file @
b2ca6ae5
...
...
@@ -22,7 +22,7 @@ use Longman\TelegramBot\Telegram;
class
TelegramTest
extends
TestCase
{
/**
* @var
\Longman\TelegramBot\
Telegram
* @var Telegram
*/
private
$telegram
;
...
...
tests/unit/TestHelpers.php
View file @
b2ca6ae5
...
...
@@ -85,7 +85,7 @@ class TestHelpers
*
* @param array $data Pass custom data array if needed
*
* @return
\Longman\TelegramBot\Entities\
Update
* @return Update
*/
public
static
function
getFakeUpdateObject
(
$data
=
null
)
{
...
...
@@ -107,7 +107,7 @@ class TestHelpers
*
* @param string $command_text
*
* @return
\Longman\TelegramBot\Entities\
Update
* @return Update
*/
public
static
function
getFakeUpdateCommandObject
(
$command_text
)
{
...
...
@@ -129,7 +129,7 @@ class TestHelpers
*
* @param array $data Pass custom data array if needed
*
* @return
\Longman\TelegramBot\Entities\
User
* @return User
*/
public
static
function
getFakeUserObject
(
array
$data
=
[])
{
...
...
@@ -143,7 +143,7 @@ class TestHelpers
*
* @param array $data Pass custom data array if needed
*
* @return
\Longman\TelegramBot\Entities\
Chat
* @return Chat
*/
public
static
function
getFakeChatObject
(
array
$data
=
[])
{
...
...
@@ -179,7 +179,7 @@ class TestHelpers
* @param array $user_data Pass custom user data array if needed
* @param array $chat_data Pass custom chat data array if needed
*
* @return
\Longman\TelegramBot\Entities\
Message
* @return Message
*/
public
static
function
getFakeMessageObject
(
array
$message_data
=
[],
array
$user_data
=
[],
array
$chat_data
=
[])
{
...
...
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