TidewaysProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
c 0
b 0
f 0
dl 0
loc 23
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A disable() 0 9 1
A enable() 0 3 1
1
<?php
2
3
namespace Bavix\XHProf\Providers;
4
5
use XHProfRuns_Default;
0 ignored issues
show
Bug introduced by
The type XHProfRuns_Default was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
7
class TidewaysProvider implements ProviderInterface
8
{
9
10
    /**
11
     * @inheritDoc
12
     */
13
    public function enable()
14
    {
15
        tideways_xhprof_enable(config('xhprof.flags', 0));
0 ignored issues
show
Bug introduced by
The function tideways_xhprof_enable 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

15
        /** @scrutinizer ignore-call */ 
16
        tideways_xhprof_enable(config('xhprof.flags', 0));
Loading history...
16
    }
17
18
    /**
19
     * @inheritDoc
20
     */
21
    public function disable()
22
    {
23
        $data = tideways_xhprof_disable();
0 ignored issues
show
Bug introduced by
The function tideways_xhprof_disable 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

23
        $data = /** @scrutinizer ignore-call */ tideways_xhprof_disable();
Loading history...
24
25
        $run_id = config('xhprof.run_id', null) ?? uniqid();
26
27
        file_put_contents(
28
                config('xhprof.output_dir', '/tmp') . '/' . $run_id . '.' . config('xhprof.name') . '.xhprof',
29
                serialize($data)
30
                );
31
    }
32
33
}
34