Issues (32)

NewRelic/NewRelicInteractor.php (1 issue)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of Ekino New Relic bundle.
7
 *
8
 * (c) Ekino - Thomas Rabaix <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Ekino\NewRelicBundle\NewRelic;
15
16
class NewRelicInteractor implements NewRelicInteractorInterface
17
{
18
    public function setApplicationName(string $name, string $license = null, bool $xmit = false): bool
19
    {
20
        return newrelic_set_appname($name, $license, $xmit);
21
    }
22
23
    public function setTransactionName(string $name): bool
24
    {
25
        return newrelic_name_transaction($name);
26
    }
27
28
    public function ignoreTransaction(): void
29
    {
30
        newrelic_ignore_transaction();
31
    }
32
33
    public function addCustomEvent(string $name, array $attributes): void
34
    {
35
        newrelic_record_custom_event((string) $name, $attributes);
36
    }
37
38
    public function addCustomMetric(string $name, float $value): bool
39
    {
40
        return newrelic_custom_metric($name, $value);
41
    }
42
43
    public function addCustomParameter(string $name, $value): bool
44
    {
45
        return newrelic_add_custom_parameter((string) $name, $value);
46
    }
47
48
    public function getBrowserTimingHeader(bool $includeTags = true): string
49
    {
50
        return newrelic_get_browser_timing_header($includeTags);
51
    }
52
53
    public function getBrowserTimingFooter(bool $includeTags = true): string
54
    {
55
        return newrelic_get_browser_timing_footer($includeTags);
56
    }
57
58
    public function disableAutoRUM(): ?bool
59
    {
60
        return newrelic_disable_autorum();
61
    }
62
63
    public function noticeError(int $errno, string $errstr, string $errfile = null, int $errline = null, string $errcontext = null): void
64
    {
65
        newrelic_notice_error($errno, $errstr, $errfile, $errline, $errcontext);
66
    }
67
68
    public function noticeThrowable(\Throwable $e, string $message = null): void
69
    {
70
        newrelic_notice_error($message ?: $e->getMessage(), $e);
71
    }
72
73
    public function enableBackgroundJob(): void
74
    {
75
        newrelic_background_job(true);
76
    }
77
78
    public function disableBackgroundJob(): void
79
    {
80
        newrelic_background_job(false);
81
    }
82
83
    public function endTransaction(bool $ignore = false): bool
84
    {
85
        return newrelic_end_transaction($ignore);
86
    }
87
88
    public function startTransaction(string $name = null, string $license = null): bool
89
    {
90
        if (null === $name) {
91
            $name = \ini_get('newrelic.appname');
92
        }
93
94
        if (null === $license) {
95
            return newrelic_start_transaction($name);
96
        }
97
98
        return newrelic_start_transaction($name, $license);
99
    }
100
101
    public function excludeFromApdex(): void
102
    {
103
        newrelic_ignore_apdex();
104
    }
105
106
    public function addCustomTracer(string $name): bool
107
    {
108
        return newrelic_add_custom_tracer($name);
109
    }
110
111
    public function setCaptureParams(bool $enabled): void
112
    {
113
        newrelic_capture_params($enabled);
114
    }
115
116
    public function stopTransactionTiming(): void
117
    {
118
        newrelic_end_of_transaction();
119
    }
120
121
    public function recordDatastoreSegment(callable $func, array $parameters)
122
    {
123
        return newrelic_record_datastore_segment($func, $parameters);
0 ignored issues
show
The function newrelic_record_datastore_segment was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

123
        return /** @scrutinizer ignore-call */ newrelic_record_datastore_segment($func, $parameters);
Loading history...
124
    }
125
126
    public function setUserAttributes(string $userValue, string $accountValue, string $productValue): bool
127
    {
128
        return newrelic_set_user_attributes($userValue, $accountValue, $productValue);
129
    }
130
}
131