Test Failed
Push — main ( ea931b...8f4107 )
by Bingo
06:03
created

TelemetryUtil::toggleLocalTelemetry()   A

Complexity

Conditions 5
Paths 5

Size

Total Lines 13
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 13
rs 9.6111
cc 5
nc 5
nop 3
1
<?php
2
3
namespace Jabe\Engine\Impl\Util;
4
5
use Jabe\Engine\Impl\Metrics\MetricsRegistry;
6
use Jabe\Engine\Impl\Telemetry\TelemetryRegistry;
7
8
class TelemetryUtil
9
{
10
    public static function toggleLocalTelemetry(
11
        bool $telemetryActivated,
12
        TelemetryRegistry $telemetryRegistry,
13
        MetricsRegistry $metricsRegistry
14
    ): void {
15
        $previouslyActivated = $telemetryRegistry->setTelemetryLocallyActivated($telemetryActivated);
0 ignored issues
show
Bug introduced by
The method setTelemetryLocallyActivated() does not exist on Jabe\Engine\Impl\Telemetry\TelemetryRegistry. ( Ignorable by Annotation )

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

15
        /** @scrutinizer ignore-call */ 
16
        $previouslyActivated = $telemetryRegistry->setTelemetryLocallyActivated($telemetryActivated);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
16
17
        if (!$previouslyActivated && $telemetryActivated) {
18
            if ($telemetryRegistry !== null) {
19
                $telemetryRegistry->clearCommandCounts();
0 ignored issues
show
Bug introduced by
The method clearCommandCounts() does not exist on Jabe\Engine\Impl\Telemetry\TelemetryRegistry. ( Ignorable by Annotation )

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

19
                $telemetryRegistry->/** @scrutinizer ignore-call */ 
20
                                    clearCommandCounts();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
20
            }
21
            if ($metricsRegistry !== null) {
22
                $metricsRegistry->clearTelemetryMetrics();
23
            }
24
        }
25
    }
26
}
27