SearchResponse   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 15
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getResponseData() 0 9 2
1
<?php
2
3
namespace seregazhuk\PinterestBot\Api;
4
5
class SearchResponse extends Response
6
{
7
    /**
8
     * @param null $key
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $key is correct as it would always require null to be passed?
Loading history...
9
     * @return array
10
     */
11
    public function getResponseData($key = null)
12
    {
13
        // First response is special and returns data in 'resource_response.data.results` array
14
        $data = $this->getData('resource_response.data.results', []);
15
16
        // All the next responses look as expected
17
        return empty($data) ?
0 ignored issues
show
Bug Best Practice introduced by
The expression return empty($data) ? pa...tResponseData() : $data also could return the type boolean which is incompatible with the documented return type array.
Loading history...
18
            parent::getResponseData() :
19
            $data;
20
    }
21
}
22