Platforms   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 8
c 1
b 0
f 1
dl 0
loc 18
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A starting() 0 13 1
1
<?php
2
/**
3
 * Platforms initialize
4
 * User: moyo
5
 * Date: 13/12/2017
6
 * Time: 10:20 AM
7
 */
8
9
namespace Carno\Traced\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\Traced\Contracts\Observer;
16
use Carno\Traced\Platform\Zipkin;
17
use Carno\Tracing\Contracts\Platform;
18
19
class Platforms extends Component implements Bootable
20
{
21
    /**
22
     * @param Application $app
23
     */
24
    public function starting(Application $app) : void
25
    {
26
        $zpk = new Zipkin($app->conf());
27
28
        DI::set(Platform::class, $zpk);
29
        DI::set(Observer::class, $zpk);
30
31
        $app->starting()->add(static function () use ($zpk) {
32
            return $zpk->init();
33
        });
34
35
        $app->stopping()->add(static function () use ($zpk) {
36
            return $zpk->leave();
37
        });
38
    }
39
}
40