1 | <?php |
||
11 | class Transaction |
||
12 | { |
||
13 | private $instance; |
||
14 | private $config; |
||
15 | private $formatter; |
||
16 | |||
17 | /** |
||
18 | * Transaction constructor. |
||
19 | * @param $instance |
||
20 | * @param TransactionConfig $config |
||
21 | */ |
||
22 | 13 | public function __construct($instance, TransactionConfig $config) |
|
36 | |||
37 | /** |
||
38 | * @param FormatterInterface $formatter |
||
39 | */ |
||
40 | public function setFormatter(FormatterInterface $formatter) |
||
44 | |||
45 | /** |
||
46 | * @inheritdoc |
||
47 | * @throws \Exception |
||
48 | */ |
||
49 | 11 | public function __call($name, $arguments) |
|
62 | |||
63 | /** |
||
64 | * @param $customParameters |
||
65 | */ |
||
66 | 11 | private function addNewRelicParameter($customParameters) |
|
67 | { |
||
68 | 11 | foreach ($customParameters as $key => $value) { |
|
69 | 2 | if (null === $value || is_scalar($value)) { |
|
70 | 2 | newrelic_add_custom_parameter($key, $value); |
|
71 | } else { |
||
72 | newrelic_add_custom_parameter($key, @json_encode($value)); |
||
73 | } |
||
74 | } |
||
75 | 11 | } |
|
76 | |||
77 | /** |
||
78 | * @param string $name |
||
79 | * @param mixed $arguments |
||
80 | */ |
||
81 | 11 | private function transactionStart($name, $arguments) |
|
97 | |||
98 | /** |
||
99 | * @param $name |
||
100 | * @return bool |
||
101 | */ |
||
102 | 11 | private function shouldBeMonitored($name) |
|
106 | |||
107 | /** |
||
108 | * @param $name |
||
109 | */ |
||
110 | 11 | private function transactionEnd($name) |
|
118 | |||
119 | /** |
||
120 | * @param $name |
||
121 | * @param \Exception $genericException |
||
122 | */ |
||
123 | 3 | private function transactionFail($name, \Exception $genericException) |
|
131 | } |
||
132 |