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
4e84bce5
Unverified
Commit
4e84bce5
authored
Apr 21, 2018
by
Avtandil Kikabidze
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move ServerResponse class inside http namespace
parent
3ea4b048
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
50 additions
and
27 deletions
+50
-27
ChatsCommand.php
src/Commands/AdminCommands/ChatsCommand.php
+1
-1
CleanupCommand.php
src/Commands/AdminCommands/CleanupCommand.php
+2
-2
SendtoallCommand.php
src/Commands/AdminCommands/SendtoallCommand.php
+2
-2
SendtochannelCommand.php
src/Commands/AdminCommands/SendtochannelCommand.php
+2
-2
WhoisCommand.php
src/Commands/AdminCommands/WhoisCommand.php
+1
-1
Command.php
src/Commands/Command.php
+5
-5
SystemCommand.php
src/Commands/SystemCommand.php
+1
-1
GenericmessageCommand.php
src/Commands/SystemCommands/GenericmessageCommand.php
+2
-2
PreCheckoutQuery.php
src/Entities/Payments/PreCheckoutQuery.php
+1
-1
ShippingQuery.php
src/Entities/Payments/ShippingQuery.php
+1
-1
Request.php
src/Http/Request.php
+5
-5
ServerResponse.php
src/Http/ServerResponse.php
+26
-3
ServerResponseTest.php
tests/unit/Entities/ServerResponseTest.php
+1
-1
No files found.
src/Commands/AdminCommands/ChatsCommand.php
View file @
4e84bce5
...
...
@@ -45,7 +45,7 @@ class ChatsCommand extends AdminCommand
/**
* Command execute method
*
* @return \Longman\TelegramBot\
Entities
\ServerResponse
* @return \Longman\TelegramBot\
Http
\ServerResponse
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public
function
execute
()
...
...
src/Commands/AdminCommands/CleanupCommand.php
View file @
4e84bce5
...
...
@@ -326,7 +326,7 @@ class CleanupCommand extends AdminCommand
/**
* Execution if MySQL is required but not available
*
* @return \Longman\TelegramBot\
Entities
\ServerResponse
* @return \Longman\TelegramBot\
Http
\ServerResponse
*/
public
function
executeNoDb
()
{
...
...
@@ -345,7 +345,7 @@ class CleanupCommand extends AdminCommand
/**
* Command execute method
*
* @return \Longman\TelegramBot\
Entities
\ServerResponse
* @return \Longman\TelegramBot\
Http
\ServerResponse
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public
function
execute
()
...
...
src/Commands/AdminCommands/SendtoallCommand.php
View file @
4e84bce5
...
...
@@ -12,7 +12,7 @@ namespace Longman\TelegramBot\Commands\AdminCommands;
use
Longman\TelegramBot\Commands\AdminCommand
;
use
Longman\TelegramBot\Entities\Message
;
use
Longman\TelegramBot\
Entities
\ServerResponse
;
use
Longman\TelegramBot\
Http
\ServerResponse
;
use
Longman\TelegramBot\Http\Request
;
/**
...
...
@@ -48,7 +48,7 @@ class SendtoallCommand extends AdminCommand
/**
* Execute command
*
* @return \Longman\TelegramBot\
Entities
\ServerResponse
* @return \Longman\TelegramBot\
Http
\ServerResponse
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public
function
execute
()
...
...
src/Commands/AdminCommands/SendtochannelCommand.php
View file @
4e84bce5
...
...
@@ -54,7 +54,7 @@ class SendtochannelCommand extends AdminCommand
/**
* Command execute method
*
* @return \Longman\TelegramBot\
Entities
\ServerResponse|mixed
* @return \Longman\TelegramBot\
Http
\ServerResponse|mixed
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public
function
execute
()
...
...
@@ -275,7 +275,7 @@ class SendtochannelCommand extends AdminCommand
* @param \Longman\TelegramBot\Entities\Message $message
* @param array $data
*
* @return \Longman\TelegramBot\
Entities
\ServerResponse
* @return \Longman\TelegramBot\
Http
\ServerResponse
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
protected
function
sendBack
(
Message
$message
,
array
$data
)
...
...
src/Commands/AdminCommands/WhoisCommand.php
View file @
4e84bce5
...
...
@@ -52,7 +52,7 @@ class WhoisCommand extends AdminCommand
/**
* Command execute method
*
* @return \Longman\TelegramBot\
Entities
\ServerResponse
* @return \Longman\TelegramBot\
Http
\ServerResponse
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public
function
execute
()
...
...
src/Commands/Command.php
View file @
4e84bce5
...
...
@@ -143,7 +143,7 @@ abstract class Command
/**
* Pre-execute command
*
* @return \Longman\TelegramBot\
Entities
\ServerResponse
* @return \Longman\TelegramBot\
Http
\ServerResponse
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public
function
preExecute
()
...
...
@@ -176,7 +176,7 @@ abstract class Command
/**
* Execute command
*
* @return \Longman\TelegramBot\
Entities
\ServerResponse
* @return \Longman\TelegramBot\
Http
\ServerResponse
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
abstract
public
function
execute
();
...
...
@@ -184,7 +184,7 @@ abstract class Command
/**
* Execution if MySQL is required but not available
*
* @return \Longman\TelegramBot\
Entities
\ServerResponse
* @return \Longman\TelegramBot\
Http
\ServerResponse
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public
function
executeNoDb
()
...
...
@@ -393,7 +393,7 @@ abstract class Command
* @param string $text
* @param array $data
*
* @return \Longman\TelegramBot\
Entities
\ServerResponse
* @return \Longman\TelegramBot\
Http
\ServerResponse
*/
public
function
replyToChat
(
$text
,
array
$data
=
[])
{
...
...
@@ -413,7 +413,7 @@ abstract class Command
* @param string $text
* @param array $data
*
* @return \Longman\TelegramBot\
Entities
\ServerResponse
* @return \Longman\TelegramBot\
Http
\ServerResponse
*/
public
function
replyToUser
(
$text
,
array
$data
=
[])
{
...
...
src/Commands/SystemCommand.php
View file @
4e84bce5
...
...
@@ -20,7 +20,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 \Longman\TelegramBot\
Http
\ServerResponse
*/
public
function
execute
()
{
...
...
src/Commands/SystemCommands/GenericmessageCommand.php
View file @
4e84bce5
...
...
@@ -42,7 +42,7 @@ class GenericmessageCommand extends SystemCommand
/**
* Execution if MySQL is required but not available
*
* @return \Longman\TelegramBot\
Entities
\ServerResponse
* @return \Longman\TelegramBot\
Http
\ServerResponse
*/
public
function
executeNoDb
()
{
...
...
@@ -53,7 +53,7 @@ class GenericmessageCommand extends SystemCommand
/**
* Execute command
*
* @return \Longman\TelegramBot\
Entities
\ServerResponse
* @return \Longman\TelegramBot\
Http
\ServerResponse
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public
function
execute
()
...
...
src/Entities/Payments/PreCheckoutQuery.php
View file @
4e84bce5
...
...
@@ -48,7 +48,7 @@ class PreCheckoutQuery extends Entity
* @param bool $ok
* @param array $data
*
* @return \Longman\TelegramBot\
Entities
\ServerResponse
* @return \Longman\TelegramBot\
Http
\ServerResponse
*/
public
function
answer
(
$ok
,
array
$data
=
[])
{
...
...
src/Entities/Payments/ShippingQuery.php
View file @
4e84bce5
...
...
@@ -45,7 +45,7 @@ class ShippingQuery extends Entity
* @param bool $ok
* @param array $data
*
* @return \Longman\TelegramBot\
Entities
\ServerResponse
* @return \Longman\TelegramBot\
Http
\ServerResponse
*/
public
function
answer
(
$ok
,
array
$data
=
[])
{
...
...
src/Http/Request.php
View file @
4e84bce5
...
...
@@ -14,7 +14,7 @@ use GuzzleHttp\Client;
use
GuzzleHttp\Exception\RequestException
;
use
Longman\TelegramBot\DB
;
use
Longman\TelegramBot\Entities\File
;
use
Longman\TelegramBot\
Entities
\ServerResponse
;
use
Longman\TelegramBot\
Http
\ServerResponse
;
use
Longman\TelegramBot\Exception\TelegramException
;
use
Longman\TelegramBot\Telegram
;
use
Longman\TelegramBot\TelegramLog
;
...
...
@@ -504,7 +504,7 @@ class Request
* @param string $action
* @param array $data
*
* @return \Longman\TelegramBot\
Entities
\ServerResponse
* @return \Longman\TelegramBot\
Http
\ServerResponse
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public
static
function
send
(
$action
,
array
$data
=
[])
...
...
@@ -589,7 +589,7 @@ class Request
*
* @param array $data
*
* @return \Longman\TelegramBot\
Entities
\ServerResponse
* @return \Longman\TelegramBot\
Http
\ServerResponse
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public
static
function
sendMessage
(
array
$data
)
...
...
@@ -614,7 +614,7 @@ class Request
* @param string $action
* @param array $data
*
* @return \Longman\TelegramBot\
Entities
\ServerResponse
* @return \Longman\TelegramBot\
Http
\ServerResponse
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public
static
function
__callStatic
(
$action
,
array
$data
)
...
...
@@ -632,7 +632,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 \Longman\TelegramBot\
Http
\ServerResponse
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public
static
function
emptyResponse
()
...
...
src/
Entities
/ServerResponse.php
→
src/
Http
/ServerResponse.php
View file @
4e84bce5
...
...
@@ -6,7 +6,7 @@
* file that was distributed with this source code.
*/
namespace
Longman\TelegramBot\
Entities
;
namespace
Longman\TelegramBot\
Http
;
/**
* Class ServerResponse
...
...
@@ -20,7 +20,7 @@ namespace Longman\TelegramBot\Entities;
*
* @todo method ResponseParameters getParameters() Field which can help to automatically handle the error
*/
class
ServerResponse
extends
Entity
class
ServerResponse
{
/**
* ServerResponse constructor.
...
...
@@ -47,7 +47,30 @@ class ServerResponse extends Entity
}
}
parent
::
__construct
(
$data
,
$bot_username
);
//Make sure we're not raw_data inception-ing
if
(
array_key_exists
(
'raw_data'
,
$data
))
{
if
(
$data
[
'raw_data'
]
===
null
)
{
unset
(
$data
[
'raw_data'
]);
}
}
else
{
$data
[
'raw_data'
]
=
$data
;
}
$data
[
'bot_username'
]
=
$bot_username
;
$this
->
assignMemberVariables
(
$data
);
}
/**
* Helper to set member variables
*
* @param array $data
*/
protected
function
assignMemberVariables
(
array
$data
)
{
foreach
(
$data
as
$key
=>
$value
)
{
$this
->
$key
=
$value
;
}
}
/**
...
...
tests/unit/Entities/ServerResponseTest.php
View file @
4e84bce5
...
...
@@ -13,7 +13,7 @@
namespace
Longman\TelegramBot\Tests\Unit
;
use
Longman\TelegramBot\Entities\Message
;
use
Longman\TelegramBot\
Entities
\ServerResponse
;
use
Longman\TelegramBot\
Http
\ServerResponse
;
use
Longman\TelegramBot\Http\Request
;
/**
...
...
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