Passed
Push — master ( bbba47...f8583f )
by KwangSeob
03:39
created

StatusService   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getAll() 0 18 2
1
<?php
2
3
namespace JiraRestApi\Status;
4
5
6
use JiraRestApi\JiraException;
7
use JsonMapper_Exception;
8
9
class StatusService extends \JiraRestApi\JiraClient
10
{
11
    private $uri = '/status';
12
13
    /**
14
     * get all statuses
15
     * @throws JiraException
16
     * @throws JsonMapper_Exception
17
     *
18
     * @return Status[] array of Project class
19
     */
20
    public function getAll()
21
    {
22
        if ($this->isRestApiV3()) {
23
            throw new JiraException('V3 is currently not supported');
24
        }
25
26
        else {
27
            $statusObject = new Status();
0 ignored issues
show
Unused Code introduced by
The assignment to $statusObject is dead and can be removed.
Loading history...
28
        }
29
30
        $ret = $this->exec($this->uri.'/', null);
31
        $this->log->info("Result=\n".$ret);
0 ignored issues
show
Bug introduced by
Are you sure $ret of type string|true can be used in concatenation? ( Ignorable by Annotation )

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

31
        $this->log->info("Result=\n"./** @scrutinizer ignore-type */ $ret);
Loading history...
32
33
34
        return $this->json_mapper->mapArray(
35
            json_decode($ret, false),
0 ignored issues
show
Bug introduced by
It seems like $ret can also be of type true; however, parameter $json of json_decode() does only seem to accept string, 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

35
            json_decode(/** @scrutinizer ignore-type */ $ret, false),
Loading history...
36
            new \ArrayObject(),
37
            '\JiraRestApi\Status\status'
38
        );
39
    }
40
}
41