Passed
Pull Request — 0.9.x (#325)
by Shinji
01:52
created

Context   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 28
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A start() 0 2 1
A isRunning() 0 3 1
A __construct() 0 4 1
A stop() 0 3 1
A getProtocol() 0 3 1
1
<?php
2
3
/**
4
 * This file is part of the reliforp/reli-prof 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 Reli\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
18
/**
19
 * @template-covariant T of MessageProtocolInterface
20
 * @implements ContextInterface<T>
21
 */
22
final class Context implements ContextInterface
23
{
24
    /** @param T $protocol_interface */
0 ignored issues
show
Bug introduced by
The type Reli\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...
25
    public function __construct(
26
        private AmphpContext $amphp_context,
27
        private object $protocol_interface
28
    ) {
29
    }
30
31
    public function start(): void
32
    {
33
        ;
34
    }
35
36
    public function isRunning(): bool
37
    {
38
        return !$this->amphp_context->isClosed();
39
    }
40
41
    public function stop(): void
42
    {
43
        $this->amphp_context->close();
44
    }
45
46
    /** @return T */
47
    public function getProtocol(): object
48
    {
49
        return $this->protocol_interface;
50
    }
51
}
52