1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
4
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS |
5
|
|
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
6
|
|
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER |
7
|
|
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
8
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace MpaFirephpWrapper\Service; |
12
|
|
|
|
13
|
|
|
use FirePHP; |
14
|
|
|
use MpaFirephpWrapper\Options\FirephpWrapperOptions; |
15
|
|
|
|
16
|
|
|
class FirephpWrapper |
17
|
|
|
{ |
18
|
|
|
/** @var FirePHP $firephp */ |
19
|
|
|
protected $firephp; |
20
|
|
|
protected $howManyLogged; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @param FirephpWrapperOptions $options |
24
|
|
|
*/ |
25
|
10 |
|
public function __construct(FirephpWrapperOptions $options) |
26
|
|
|
{ |
27
|
10 |
|
$this->setFirephp(new FirePHP()); |
28
|
10 |
|
$this->firephp->setOptions($options->toArray()); |
29
|
|
|
|
30
|
10 |
|
return $this; |
|
|
|
|
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @param $object |
35
|
|
|
* @param string $type |
36
|
|
|
* @param null $label |
37
|
|
|
* @param array $options |
38
|
|
|
* @return self |
39
|
|
|
*/ |
40
|
5 |
|
public function write($object, $type = 'info', $label = null, $options = []) |
41
|
|
|
{ |
42
|
5 |
|
$this->howManyLogged++; |
43
|
5 |
|
$this->firephp->$type($object, $label, $options); |
44
|
|
|
|
45
|
5 |
|
return $this; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @return int |
50
|
|
|
*/ |
51
|
3 |
|
public function howManyLogged() |
52
|
|
|
{ |
53
|
3 |
|
return $this->howManyLogged; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @param \FirePHP $firephp |
58
|
|
|
*/ |
59
|
10 |
|
public function setFirephp($firephp) |
60
|
|
|
{ |
61
|
10 |
|
$this->firephp = $firephp; |
62
|
10 |
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @return \FirePHP |
66
|
|
|
*/ |
67
|
2 |
|
public function getFirephp() |
68
|
|
|
{ |
69
|
2 |
|
return $this->firephp; |
70
|
|
|
} |
71
|
|
|
} |
72
|
|
|
|