Issues (7)

src/Chips/LDKit.php (1 issue)

Labels
Severity
1
<?php
2
/**
3
 * Bootstrap load kit
4
 * User: moyo
5
 * Date: 2018-11-25
6
 * Time: 20:31
7
 */
8
9
namespace Carno\Console\Chips;
10
11
use Carno\Console\Component;
12
use Carno\Console\Contracts\Application;
13
use Carno\Console\Contracts\Bootable;
14
15
trait LDKit
16
{
17
    /**
18
     * @param Application $app
19
     * @param Bootable ...$mods
20
     */
21
    protected function booting(Application $app, Bootable ...$mods) : void
22
    {
23
        /**
24
         * @var Component $mod
25
         */
26
27
        foreach ($mods as $idx => $mod) {
28
            $mod->ordered($idx);
0 ignored issues
show
The method ordered() does not exist on Carno\Console\Contracts\Bootable. Since it exists in all sub-types, consider adding an abstract or default implementation to Carno\Console\Contracts\Bootable. ( Ignorable by Annotation )

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

28
            $mod->/** @scrutinizer ignore-call */ 
29
                  ordered($idx);
Loading history...
29
        }
30
31
        uasort($mods, static function (Bootable $com1, Bootable $com2) {
32
            return $com1->priority() <=> $com2->priority();
33
        });
34
35
        foreach ($mods as $idx => $com) {
36
            if ($com->runnable()) {
37
                $com->starting($app);
38
                logger('console')->debug('Component starting', ['p' => $com->priority(), 'com' => get_class($com)]);
39
            } else {
40
                logger('console')->debug('Component non-runnable', ['p' => $com->priority(), 'com' => get_class($com)]);
41
            }
42
        }
43
    }
44
}
45