Passed
Push — master ( c5db43...5f6140 )
by Dmitrij
02:41
created

GetCommands   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 12
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
namespace HotRodCli\Api;
4
5
use HotRodCli\AppContainer;
6
7
class GetCommands
8
{
9
    protected $container;
10
11
    public function __construct(AppContainer $appContainer)
12
    {
13
        $this->container = $appContainer;
14
    }
15
16
    public function __invoke()
17
    {
18
        return json_encode(array_keys($this->container->resolve('commands')));
0 ignored issues
show
Bug introduced by
It seems like $this->container->resolve('commands') can also be of type object and commands; however, parameter $input of array_keys() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

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

18
        return json_encode(array_keys(/** @scrutinizer ignore-type */ $this->container->resolve('commands')));
Loading history...
19
    }
20
}
21