Passed
Branch master (9963ba)
by Brian
03:22
created

JiraHelper::frLink()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 3
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * JiraHelper
5
 */
6
7
namespace Fr3nch13\Jira\View\Helper;
8
9
use Cake\Core\Configure;
10
use Cake\View\Helper;
11
use Cake\View\View;
12
use Fr3nch13\Jira\Lib\JiraProject;
13
14
/**
15
 * Jira Helper
16
 *
17
 * Helper to write out stuff about your jira project.
18
 *
19
 * @property \Cake\View\Helper\UrlHelper $Url
20
 * @property \Cake\View\Helper\HtmlHelper $Html
21
 */
22
class JiraHelper extends Helper
23
{
24
    /**
25
     * List of loaded helpers.
26
     *
27
     * @var array
28
     */
29
    public $helpers = ['Url', 'Html'];
30
31
    /**
32
     * Contains the loaded Jira Project object.
33
     *
34
     * @var \Fr3nch13\Jira\Lib\JiraProject
35
     */
36
    protected $JiraProject;
37
38
    /**
39
     * Initialize the helper
40
     *
41
     * @param \Cake\View\View $View The view object
42
     * @param array $config Helper config settings
43
     * @return void
44
     */
45 7
    public function __construct(View $View, array $config = [])
46
    {
47 7
        parent::__construct($View, $config);
48
49 7
        $this->JiraProject = new JiraProject();
50 7
    }
51
52
    /**
53
     * Get the information about the Jira Project
54
     *
55
     * @return object Object containing the information about your project.
56
     * @throws \Fr3nch13\Jira\Exception\MissingProjectException If the project can't be found.
57
     */
58 1
    public function getInfo()
59
    {
60 1
        $info = $this->JiraProject->getInfo();
61
62 1
        return $info;
63
    }
64
65
    /**
66
     * Gets a list of all versions within your project.
67
     *
68
     * @return \ArrayObject|\JiraRestApi\Issue\Version[] A list of version objects.
69
     */
70 1
    public function getVersions()
71
    {
72 1
        return $this->JiraProject->getVersions();
73
    }
74
75
    /**
76
     * Gets a list of all issues within your project.
77
     *
78
     * @return \JiraRestApi\Issue\IssueSearchResult|\JiraRestApi\Issue\IssueSearchResultV3 A list of issue objects.
79
     */
80 1
    public function getIssues()
81
    {
82 1
        return $this->JiraProject->getIssues();
83
    }
84
85
    /**
86
     * Gets a list of all open issues within your project.
87
     *
88
     * @return \JiraRestApi\Issue\IssueSearchResult|\JiraRestApi\Issue\IssueSearchResultV3 A list of issue objects.
89
     */
90 1
    public function getOpenIssues()
91
    {
92 1
        return $this->JiraProject->getOpenIssues();
93
    }
94
95
    /**
96
     * Gets info on a particular issue within your project.
97
     *
98
     * @param int $id The issue id. The integer part without the project key.
99
     * @return object the object that has the info of that issue.
100
     * @throws \Fr3nch13\Jira\Exception\MissingIssueException If the project's issue can't be found.
101
     */
102 1
    public function getIssue($id = null)
103
    {
104 1
        return $this->JiraProject->getIssue($id);
105
    }
106
107
    /**
108
     * Gets a list of all issues that are bugs within your project.
109
     *
110
     * @return \JiraRestApi\Issue\IssueSearchResult|\JiraRestApi\Issue\IssueSearchResultV3 A list of issue objects.
111
     */
112 1
    public function getBugs()
113
    {
114 1
        return $this->JiraProject->getBugs();
115
    }
116
117
    /**
118
     * Gets a list of all open issues that are bugs within your project.
119
     *
120
     * @return \JiraRestApi\Issue\IssueSearchResult|\JiraRestApi\Issue\IssueSearchResultV3 A list of issue objects.
121
     */
122 1
    public function getOpenBugs()
123
    {
124 1
        return $this->JiraProject->getOpenBugs();
125
    }
126
}
127