Completed
Push — master ( 602e3b...a4f418 )
by KwangSeob
11s
created

SprintService::getSprintFromJSON()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: meshulam
5
 * Date: 11/08/2017
6
 * Time: 17:28
7
 */
8
9
namespace JiraRestApi\Sprint;
10
11
use JiraRestApi\Configuration\ConfigurationInterface;
12
use JiraRestApi\JiraException;
13
use JiraRestApi\JiraClient;
14
use Monolog\Logger;
15
16
17
class SprintService extends  JiraClient
18
{
19
    //https://jira01.devtools.intel.com/rest/agile/1.0/board?projectKeyOrId=34012
20
    private $uri = '/sprint';
21
22
    public function __construct(ConfigurationInterface $configuration = null, Logger $logger = null, $path = './')
23
    {
24
        parent::__construct($configuration, $logger, $path);
25
        $this->setAPIUri('/rest/agile/1.0');
26
    }
27
28
    public function getSprintFromJSON($json)
29
    {
30
        $sprint= $this->json_mapper->map(
31
            $json, new Sprint()
32
        );
33
34
        return $sprint;
35
    }
36
37
    /**
38
     *  get all Sprint list.
39
     *
40
     * @param Sprint $sprintObject
41
     *
42
     * @throws JiraException
43
     * @throws \JsonMapper_Exception
44
     *
45
     * @return  object
46
     */
47
    public function getSprint($sprintObject = null)
48
    {
49
        $sprintObject = ($sprintObject ) ? $sprintObject : new Sprint();
50
51
        $ret = $this->exec($this->uri.'/$sprintId' , null);
52
53
        $this->log->addInfo("Result=\n".$ret);
54
55
        return $sprint = $this->json_mapper->map(
0 ignored issues
show
Unused Code introduced by
The assignment to $sprint is dead and can be removed.
Loading history...
56
            json_decode($ret), $sprintObject
57
        );
58
    }
59
60
}
61