Issues (6)

src/Providers/XHProfProvider.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Bavix\XHProf\Providers;
4
5
use XHProfRuns_Default;
0 ignored issues
show
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
use function xhprof_disable;
7
use function xhprof_enable;
8
9
class XHProfProvider implements ProviderInterface
10
{
11
12
    /**
13
     * @inheritDoc
14
     */
15
    public function enable()
16
    {
17
        xhprof_enable(config('xhprof.flags', 0));
18
    }
19
20
    /**
21
     * @inheritDoc
22
     */
23
    public function disable()
24
    {
25
        $data = xhprof_disable();
26
27
        $run_id = config('xhprof.run_id', null) ?? uniqid();
28
29
        file_put_contents(
30
                config('xhprof.output_dir', '/tmp') . '/' . $run_id . '.' . config('xhprof.name') . '.xhprof',
31
                serialize($data)
32
                );
33
    }
34
35
}
36