Completed
Push — master ( ace84b...72cf7f )
by KwangSeob
9s
created

PriorityService::getAll()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 16
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 8
nc 2
nop 0
dl 0
loc 16
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace JiraRestApi\Priority;
4
5
/**
6
 * Class to query priority.
7
 */
8
class PriorityService extends \JiraRestApi\JiraClient
9
{
10
    private $uri = '/priority';
11
12
    /**
13
     * Function to get all priorities.
14
     *
15
     * @throws \JiraRestApi\JiraException
16
     * @throws \JsonMapper_Exception
17
     *
18
     * @return Priority|object Priority class
19
     */
20
    public function getAll()
21
    {
22
        $queryParam = '?'.http_build_query();
0 ignored issues
show
Unused Code introduced by
The assignment to $queryParam is dead and can be removed.
Loading history...
Bug introduced by
The call to http_build_query() has too few arguments starting with query_data. ( Ignorable by Annotation )

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

22
        $queryParam = '?'./** @scrutinizer ignore-call */ http_build_query();

This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
23
24
        $ret = $this->exec($this->uri, null);
25
26
        $this->log->addInfo("Result=\n".$ret);
27
28
        $priorityData = json_decode($ret);
29
        $priorities = [];
30
31
        foreach ($priorityData as $priority) {
32
            $priorities[] = $this->json_mapper->map($priority, new Priority());
33
        }
34
35
        return $priorities;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $priorities returns the type array|array<mixed,object> which is incompatible with the documented return type object|JiraRestApi\Priority\Priority.
Loading history...
36
    }
37
}
38