|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* This file is part of the sj-i/php-profiler package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) sji <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
declare(strict_types=1); |
|
13
|
|
|
|
|
14
|
|
|
namespace PhpProfiler\Inspector\Settings; |
|
15
|
|
|
|
|
16
|
|
|
use PhpProfiler\Inspector\Settings\InspectorSettingsException; |
|
17
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
|
|
|
|
|
|
18
|
|
|
|
|
19
|
|
|
final class DaemonSettings |
|
20
|
|
|
{ |
|
21
|
|
|
private const TARGET_REGEX_DEFAULT = '^php-fpm'; |
|
22
|
|
|
|
|
23
|
|
|
public string $target_regex; |
|
24
|
|
|
public int $threads; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* DaemonSettings constructor. |
|
28
|
|
|
* @param string $target_regex |
|
29
|
|
|
* @param int $threads |
|
30
|
|
|
*/ |
|
31
|
|
|
public function __construct(string $target_regex, int $threads) |
|
32
|
|
|
{ |
|
33
|
|
|
$this->target_regex = $target_regex; |
|
34
|
|
|
$this->threads = $threads; |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* @param InputInterface $input |
|
39
|
|
|
* @return self |
|
40
|
|
|
* @throws InspectorSettingsException |
|
41
|
|
|
*/ |
|
42
|
|
|
public static function fromConsoleInput(InputInterface $input): self |
|
43
|
|
|
{ |
|
44
|
|
|
$threads = $input->getOption('threads'); |
|
45
|
|
|
if (is_null($threads)) { |
|
46
|
|
|
$threads = 8; |
|
47
|
|
|
} |
|
48
|
|
|
$threads = filter_var($threads, FILTER_VALIDATE_INT); |
|
49
|
|
|
if ($threads === false) { |
|
50
|
|
|
throw DaemonInspectorSettingsException::create(DaemonInspectorSettingsException::THREADS_IS_NOT_INTEGER); |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
$target_regex = $input->getOption('target-regex') ?? self::TARGET_REGEX_DEFAULT; |
|
54
|
|
|
if (!is_string($target_regex)) { |
|
55
|
|
|
throw DaemonInspectorSettingsException::create( |
|
56
|
|
|
DaemonInspectorSettingsException::TARGET_REGEX_IS_NOT_STRING |
|
57
|
|
|
); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
return new self('{' . $target_regex . '}', $threads); |
|
61
|
|
|
} |
|
62
|
|
|
} |
|
63
|
|
|
|
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths