Completed
Push — master ( bd46f2...d4c7f5 )
by Roman
08:20
created

BaseSender::setDebugMode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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