Issues (35)

src/Components/Tracing.php (1 issue)

Labels
Severity
1
<?php
2
/**
3
 * Tracing injector
4
 * User: moyo
5
 * Date: 2018/9/5
6
 * Time: 4:50 PM
7
 */
8
9
namespace Carno\HRPC\Components;
10
11
use Carno\Console\Component;
12
use Carno\Console\Contracts\Application;
13
use Carno\Console\Contracts\Bootable;
14
use Carno\Container\DI;
15
use Carno\HRPC\Handlers\ServerWrapper;
16
use Carno\HRPC\Handlers\TracedIncoming;
17
use Carno\HRPC\Handlers\TracedOutgoing;
18
use Carno\RPC\Server;
19
use Carno\Traced\Contracts\Observer;
0 ignored issues
show
The type Carno\Traced\Contracts\Observer 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...
20
21
class Tracing extends Component implements Bootable
22
{
23
    /**
24
     * @var int
25
     */
26
    protected $priority = 51;
27
28
    /**
29
     * @var array
30
     */
31
    protected $dependencies = [Observer::class];
32
33
    /**
34
     * @param Application $app
35
     */
36
    public function starting(Application $app) : void
37
    {
38
        /**
39
         * @var Observer $platform
40
         */
41
42
        $platform = DI::get(Observer::class);
43
44
        $platform->transportable(static function () {
45
            Server::layers()->has(TracedOutgoing::class)
46
            || Server::layers()->prepend(ServerWrapper::class, DI::object(TracedOutgoing::class));
47
            Server::layers()->has(TracedIncoming::class)
48
            || Server::layers()->append(ServerWrapper::class, DI::object(TracedIncoming::class));
49
        }, static function () {
50
            Server::layers()->remove(TracedOutgoing::class);
51
            Server::layers()->remove(TracedIncoming::class);
52
        });
53
    }
54
}
55