Passed
Pull Request — master (#13)
by Shinji
01:26
created

TargetPhpSettings::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 5
dl 0
loc 12
rs 10
c 0
b 0
f 0
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\TargetPhpSettings;
15
16
use PhpProfiler\Lib\PhpInternals\ZendTypeReader;
17
18
final class TargetPhpSettings
19
{
20
    public const PHP_REGEX_DEFAULT = '.*/(php(74|7.4|80|8.0)?|php-fpm|libphp[78].*\.so)$';
21
    public const LIBPTHREAD_REGEX_DEFAULT = '.*/libpthread.*\.so$';
22
    public const TARGET_PHP_VERSION_DEFAULT = ZendTypeReader::V74;
23
24
    public string $php_regex;
25
    public string $libpthread_regex;
26
    /** @psalm-var value-of<ZendTypeReader::ALL_SUPPORTED_VERSIONS> $php_version */
27
    public string $php_version;
28
    public ?string $php_path;
29
    public ?string $libpthread_path;
30
31
    /**
32
     * GetTraceSettings constructor.
33
     * @param string $php_regex
34
     * @param string $libpthread_regex
35
     * @param string $php_version
36
     * @param string|null $php_path
37
     * @param string|null $libpthread_path
38
     * @psalm-param value-of<ZendTypeReader::ALL_SUPPORTED_VERSIONS> $php_version
39
     */
40
    public function __construct(
41
        string $php_regex = self::PHP_REGEX_DEFAULT,
42
        string $libpthread_regex = self::LIBPTHREAD_REGEX_DEFAULT,
43
        string $php_version = ZendTypeReader::V74,
44
        ?string $php_path = null,
45
        ?string $libpthread_path = null
46
    ) {
47
        $this->php_regex = '{' . $php_regex . '}';
48
        $this->libpthread_regex = '{' . $libpthread_regex . '}';
49
        $this->php_version = $php_version;
50
        $this->php_path = $php_path;
51
        $this->libpthread_path = $libpthread_path;
52
    }
53
}
54