Passed
Push — main ( 528a1a...9cd807 )
by Yaroslav
13:38
created

HasRequestParams   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
dl 0
loc 15
ccs 0
cts 8
cp 0
rs 10
c 1
b 0
f 0
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A getRequestParams() 0 13 4
1
<?php
2
3
namespace IproSync\Console\Commands\Traits;
4
5
trait HasRequestParams
6
{
7
    protected function getRequestParams(): array
8
    {
9
        $requestParams    = [];
10
        $requestParamsStr = $this->option('request_params');
0 ignored issues
show
Bug introduced by
It seems like option() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

10
        /** @scrutinizer ignore-call */ 
11
        $requestParamsStr = $this->option('request_params');
Loading history...
11
        if ($requestParamsStr && is_string($requestParamsStr)) {
12
            parse_str(urldecode($requestParamsStr), $requestParams);
13
        }
14
15
        if(!is_array($requestParams)) {
16
            return [];
17
        }
18
19
        return $requestParams;
20
    }
21
}
22