Passed
Pull Request — master (#9)
by Shinji
01:29
created

PhpSearcherContext   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
dl 0
loc 35
c 1
b 0
f 0
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A receivePidList() 0 4 1
A __construct() 0 3 1
A start() 0 3 1
A sendTargetRegex() 0 4 1
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\Daemon\Searcher\Context;
15
16
use Amp\Parallel\Context;
0 ignored issues
show
Bug introduced by
The type Amp\Parallel\Context 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...
17
use Amp\Promise;
0 ignored issues
show
Bug introduced by
The type Amp\Promise 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...
18
use PhpProfiler\Inspector\Daemon\Dispatcher\Message\UpdateTargetProcessMessage;
19
20
final class PhpSearcherContext
21
{
22
    private Context\Context $context;
0 ignored issues
show
Bug introduced by
The type Amp\Parallel\Context\Context 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...
23
24
    public function __construct(Context\Context $context)
25
    {
26
        $this->context = $context;
27
    }
28
29
    /**
30
     * @return Promise<null>
31
     */
32
    public function start(): Promise
33
    {
34
        return $this->context->start();
35
    }
36
37
    /**
38
     * @param string $regex
39
     * @return Promise<int>
40
     */
41
    public function sendTargetRegex(string $regex): Promise
42
    {
43
        /** @var Promise<int> */
44
        return $this->context->send($regex);
45
    }
46
47
    /**
48
     * @return Promise<UpdateTargetProcessMessage>
49
     * @psalm-yield Promise<UpdateTargetProcessMessage>
50
     */
51
    public function receivePidList(): Promise
52
    {
53
        /** @var Promise<UpdateTargetProcessMessage> */
54
        return $this->context->receive();
55
    }
56
}
57