Scanner   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A starting() 0 17 3
1
<?php
2
/**
3
 * Service scanner init
4
 * User: moyo
5
 * Date: 2018/9/3
6
 * Time: 12:21 PM
7
 */
8
9
namespace Carno\HRPC\Components;
10
11
use Carno\Console\App;
12
use Carno\Console\Component;
13
use Carno\Console\Contracts\Application;
14
use Carno\Console\Contracts\Bootable;
15
use Carno\Container\DI;
16
use Carno\RPC\Service\Router;
17
use Carno\RPC\Service\Scanner as RScanner;
18
19
class Scanner extends Component implements Bootable
20
{
21
    /**
22
     * @param Application|App $app
23
     */
24
    public function starting(Application $app) : void
25
    {
26
        /**
27
         * @var Router $router
28
         * @var RScanner $scanner
29
         */
30
31
        if (defined('CWD') && is_file($rf = CWD . '/registers.php')) {
32
            DI::set(Router::class, $router = DI::object(Router::class));
33
            DI::set(RScanner::class, $scanner = DI::object(RScanner::class));
34
35
            $scanner->sources(...(array) include $rf)->serving();
36
37
            $app->named($router->server());
0 ignored issues
show
Bug introduced by
The method named() does not exist on Carno\Console\Contracts\Application. Did you maybe mean name()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

37
            $app->/** @scrutinizer ignore-call */ 
38
                  named($router->server());

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
38
39
            $app->starting()->add(static function () use ($scanner) {
40
                $scanner->analyzing();
41
            });
42
        }
43
    }
44
}
45