BaseSender::setDebugMode()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace RM\SMSender;
4
5
use GuzzleHttp;
6
use Nette\SmartObject;
7
use Nette\Utils\Strings;
8
9
/**
10
 * Base Sender
11
 */
12 1
abstract class BaseSender implements ISender
13
{
14
	use SmartObject;
15
16
	/** @var array of function (IMessage $message); Occurs before send SMS. */
17
	public $onBeforeSend;
18
19
	/** @var array of function (IMessage $message, $response); Occurs after success send SMS. */
20
	public $onSuccess;
21
22
	/** @var array of function (IMessage $message, $response); Occurs after failed send SMS. */
23
	public $onError;
24
25
	/** @var bool */
26
	protected $debug = FALSE;
27
28
	/** @var GuzzleHttp\Client */
29
	protected $httpClient;
30
31
	public function setDebugMode(bool $value) : ISender
32
	{
33 1
		$this->debug = $value;
34 1
		return $this;
35
	}
36
37
	public function getHttpClient() : GuzzleHttp\Client
38
	{
39 1
		if (!($this->httpClient instanceof GuzzleHttp\Client))
40 1
			$this->httpClient = new GuzzleHttp\Client;
41 1
		return $this->httpClient;
42
	}
43
}
44