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
a9679668
Unverified
Commit
a9679668
authored
Apr 22, 2018
by
Avtandil Kikabidze
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove custom input
parent
2cf497c9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
40 deletions
+8
-40
Client.php
src/Http/Client.php
+8
-40
No files found.
src/Http/Client.php
View file @
a9679668
...
...
@@ -164,13 +164,6 @@ class Client
*/
private
static
$client
;
/**
* Input value of the request
*
* @var string
*/
private
static
$input
;
/**
* Request limiter
*
...
...
@@ -299,31 +292,6 @@ class Client
self
::
$client
=
$client
;
}
/**
* Set input from custom input or stdin and return it
*
* @return string
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public
static
function
getInput
()
{
// First check if a custom input has been set, else get the PHP input.
if
(
!
(
$input
=
self
::
$telegram
->
getCustomInput
()))
{
$input
=
file_get_contents
(
'php://input'
);
}
// Make sure we have a string to work with.
if
(
!
is_string
(
$input
))
{
throw
new
TelegramException
(
'Input must be a string!'
);
}
self
::
$input
=
$input
;
TelegramLog
::
update
(
self
::
$input
);
return
self
::
$input
;
}
/**
* Generate general fake server response
*
...
...
@@ -333,11 +301,11 @@ class Client
*/
public
static
function
generateGeneralFakeServerResponse
(
array
$data
=
[])
{
//PARAM BINDED IN PHPUNIT TEST FOR TestServerResponse.php
//Maybe this is not the best possible implementation
//
PARAM BINDED IN PHPUNIT TEST FOR TestServerResponse.php
//
Maybe this is not the best possible implementation
//No value set in $data ie testing setWebhook
//Provided $data['chat_id'] ie testing sendMessage
//
No value set in $data ie testing setWebhook
//
Provided $data['chat_id'] ie testing sendMessage
$fake_response
=
[
'ok'
=>
true
];
// :)
...
...
@@ -421,14 +389,14 @@ class Client
);
$result
=
(
string
)
$response
->
getBody
();
//Logging getUpdates Update
//
Logging getUpdates Update
if
(
$action
===
'getUpdates'
)
{
TelegramLog
::
update
(
$result
);
}
}
catch
(
RequestException
$e
)
{
$result
=
(
$e
->
getResponse
())
?
(
string
)
$e
->
getResponse
()
->
getBody
()
:
''
;
}
finally
{
//Logging verbose debug output
//
Logging verbose debug output
TelegramLog
::
endDebugLogTempStream
(
'Verbose HTTP Request output:'
.
PHP_EOL
.
'%s'
.
PHP_EOL
);
}
...
...
@@ -596,11 +564,11 @@ class Client
$text
=
$data
[
'text'
];
do
{
//Chop off and send the first message
//
Chop off and send the first message
$data
[
'text'
]
=
mb_substr
(
$text
,
0
,
4096
);
$response
=
self
::
send
(
'sendMessage'
,
$data
);
//Prepare the next message
//
Prepare the next message
$text
=
mb_substr
(
$text
,
4096
);
}
while
(
mb_strlen
(
$text
,
'UTF-8'
)
>
0
);
...
...
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