Skip to content

Commit

Permalink
Merge branch 'v2'
Browse files Browse the repository at this point in the history
  • Loading branch information
unreal4u committed Jan 2, 2018
2 parents e4daf2a + 40e823d commit a85c21b
Show file tree
Hide file tree
Showing 7 changed files with 203 additions and 168 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
],
"require": {
"php": ">=7.0.0",
"psr/log": "^1.0",
"roave/security-advisories": "dev-master",
"unreal4u/dummy-logger": "^1.0",
"react/http-client": "^0.5",
"react/promise": "^2.5",
"clue/block-react": "^1.1",
Expand Down
199 changes: 192 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/Abstracts/TelegramTypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace unreal4u\TelegramAPI\Abstracts;

use Psr\Log\LoggerInterface;
use unreal4u\TelegramAPI\InternalFunctionality\DummyLogger;
use unreal4u\Dummy\Logger;
use unreal4u\TelegramAPI\Telegram\Types\Custom\ResultArray;

abstract class TelegramTypes
Expand All @@ -18,7 +18,7 @@ abstract class TelegramTypes
public function __construct(array $data = null, LoggerInterface $logger = null)
{
if ($logger === null) {
$logger = new DummyLogger();
$logger = new Logger();
}

$this->logger = $logger;
Expand Down
68 changes: 0 additions & 68 deletions src/InternalFunctionality/DummyLogger.php

This file was deleted.

3 changes: 2 additions & 1 deletion src/InternalFunctionality/PostOptionsConstructor.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use MultipartBuilder\Builder;
use MultipartBuilder\MultipartData;
use Psr\Log\LoggerInterface;
use unreal4u\Dummy\Logger;
use unreal4u\TelegramAPI\Abstracts\TelegramMethods;
use unreal4u\TelegramAPI\Telegram\Types\Custom\InputFile;

Expand All @@ -30,7 +31,7 @@ class PostOptionsConstructor
public function __construct(LoggerInterface $logger = null)
{
if ($logger === null) {
$logger = new DummyLogger();
$logger = new Logger();
}
$this->logger = $logger;
}
Expand Down
8 changes: 5 additions & 3 deletions src/TgLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

use Psr\Log\LoggerInterface;
use React\Promise\PromiseInterface;
use unreal4u\Dummy\Logger;
use unreal4u\TelegramAPI\Abstracts\TelegramMethods;
use unreal4u\TelegramAPI\InternalFunctionality\DummyLogger;
use unreal4u\TelegramAPI\InternalFunctionality\PostOptionsConstructor;
use unreal4u\TelegramAPI\InternalFunctionality\TelegramDocument;
use unreal4u\TelegramAPI\InternalFunctionality\TelegramResponse;
Expand Down Expand Up @@ -64,7 +64,7 @@ public function __construct(string $botToken, RequestHandlerInterface $handler,

// Initialize new dummy logger (PSR-3 compatible) if not injected
if ($logger === null) {
$logger = new DummyLogger();
$logger = new Logger();
}
$this->logger = $logger;

Expand Down Expand Up @@ -113,6 +113,8 @@ function (TelegramResponse $rawData) {
}

/**
* This is the method that actually makes the call, which can be easily overwritten so that our unit tests can work
*
* @param TelegramMethods $method
* @param array $formData
*
Expand Down Expand Up @@ -148,7 +150,7 @@ final protected function resetObjectValues(): TgLog
*/
protected function composeApiMethodUrl(TelegramMethods $call): string
{
$completeClassName = get_class($call);
$completeClassName = \get_class($call);
$this->methodName = substr($completeClassName, strrpos($completeClassName, '\\') + 1);
$this->logger->info('About to perform API request', ['method' => $this->methodName]);

Expand Down
Loading

0 comments on commit a85c21b

Please sign in to comment.