Passed
Pull Request — master (#31)
by Shinji
04:07 queued 02:36
created

Context::start()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
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\Lib\Amphp;
15
16
use Amp\Parallel\Context\Context as AmphpContext;
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...
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
19
/**
20
 * @template-covariant T of MessageProtocolInterface
21
 */
22
final class Context implements ContextInterface
23
{
24
    private AmphpContext $amphp_context;
25
    /** @var T object */
0 ignored issues
show
Bug introduced by
The type PhpProfiler\Lib\Amphp\T 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...
26
    private object $protocol_interface;
27
28
    /**
29
     * Context constructor.
30
     * @param AmphpContext $amphp_context
31
     * @param T $protocol_interface
32
     */
33
    public function __construct(
34
        AmphpContext $amphp_context,
35
        object $protocol_interface
36
    ) {
37
        $this->amphp_context = $amphp_context;
38
        $this->protocol_interface = $protocol_interface;
39
    }
40
41
    /**
42
     * @return Promise<null>
43
     */
44
    public function start(): Promise
45
    {
46
        return $this->amphp_context->start();
47
    }
48
49
    public function isRunning(): bool
50
    {
51
        return $this->amphp_context->isRunning();
52
    }
53
54
    /**
55
     * @return T
56
     */
57
    public function getProtocol(): object
58
    {
59
        return $this->protocol_interface;
60
    }
61
}
62