Update::comment()   A
last analyzed

Complexity

Conditions 2
Paths 5

Size

Total Lines 18

Duplication

Lines 18
Ratio 100 %

Importance

Changes 0
Metric Value
cc 2
nc 5
nop 0
dl 18
loc 18
rs 9.6666
c 0
b 0
f 0
1
<?php
2
3
namespace Integrations\Connectors\SenhorVerdugo;
4
5
6
class Update extends SenhorVerdugo
7
{
8 View Code Duplication
    public function issueWorklog()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
9
    {
10
        $issueKey = 'TEST-961';
11
        $workLogid = '12345';
12
13
        try {
14
            $workLog = new Worklog();
15
16
            $workLog->setComment('I did edit previous worklog here.')
17
                ->setStarted("2016-05-29 13:15:34")
18
                ->setTimeSpent('3d 4h 5m');
19
20
            $issueService = new IssueService();
21
22
            $ret = $issueService->editWorklog($issueKey, $workLog, $workLogid);
23
24
            var_dump($ret);
0 ignored issues
show
Security Debugging Code introduced by
var_dump($ret); looks like debug code. Are you sure you do not want to remove it? This might expose sensitive data.
Loading history...
25
        } catch (SenhorVerdugoException $e) {
0 ignored issues
show
Bug introduced by
The class Integrations\Connectors\...\SenhorVerdugoException does not exist. Did you forget a USE statement, or did you not list all dependencies?

Scrutinizer analyzes your composer.json/composer.lock file if available to determine the classes, and functions that are defined by your dependencies.

It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.

Loading history...
26
            $this->assertTrue(false, 'Edit worklog Failed : '.$e->getMessage());
27
        }
28
    }
29
30
    /**
31
     * Perform a transition on an issue
32
     * Note: this library uses goal status names instead of transition names. So, if you want to change issue status to 'Some Status', you should pass that status name to setTransitionName
33
     * i.e. $transition->setTransitionName('Some Status')
34
     * See SenhorVerdugo API reference
35
     */
36 View Code Duplication
    public function issueStatus()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
37
    {
38
        $issueKey = "TEST-879";
39
40
        try {            
41
            $transition = new Transition();
42
            $transition->setTransitionName('Resolved');
43
            $transition->setCommentBody('performing the transition via REST API.');
44
45
            $issueService = new IssueService();
46
47
            $issueService->transition($issueKey, $transition);
48
        } catch (SenhorVerdugoException $e) {
0 ignored issues
show
Bug introduced by
The class Integrations\Connectors\...\SenhorVerdugoException does not exist. Did you forget a USE statement, or did you not list all dependencies?

Scrutinizer analyzes your composer.json/composer.lock file if available to determine the classes, and functions that are defined by your dependencies.

It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.

Loading history...
49
            $this->assertTrue(false, "add Comment Failed : " . $e->getMessage());
50
        }
51
    }
52
53 View Code Duplication
    public function comment()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
54
    {
55
        $issueKey = "TEST-879";
56
57
        try {
58
            $commentId = 12345;
59
60
            $issueService = new IssueService();
61
                
62
            $comment = new Comment();
63
            $comment->setBody('Updated comments');
64
            
65
            $issueService->updateComment($issueKey, $commentId, $comment);
66
67
        } catch (SenhorVerdugoException $e) {
0 ignored issues
show
Bug introduced by
The class Integrations\Connectors\...\SenhorVerdugoException does not exist. Did you forget a USE statement, or did you not list all dependencies?

Scrutinizer analyzes your composer.json/composer.lock file if available to determine the classes, and functions that are defined by your dependencies.

It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.

Loading history...
68
            $this->assertTrue(false, 'Delete comment Failed : '.$e->getMessage());
69
        }
70
    }
71
72 View Code Duplication
    public function changeAssignee()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
73
    {
74
75
        $issueKey = "TEST-879";
76
77
        try {
78
            $issueService = new IssueService();
79
80
            // if assignee is -1, automatic assignee used.
81
            // A null assignee will remove the assignee.
82
            $assignee = 'newAssigneeName';
83
84
            $ret = $issueService->changeAssignee($issueKey, $assignee);
85
86
            var_dump($ret);
0 ignored issues
show
Security Debugging Code introduced by
var_dump($ret); looks like debug code. Are you sure you do not want to remove it? This might expose sensitive data.
Loading history...
87
        } catch (SenhorVerdugoException $e) {
0 ignored issues
show
Bug introduced by
The class Integrations\Connectors\...\SenhorVerdugoException does not exist. Did you forget a USE statement, or did you not list all dependencies?

Scrutinizer analyzes your composer.json/composer.lock file if available to determine the classes, and functions that are defined by your dependencies.

It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.

Loading history...
88
            $this->assertTrue(false, "Change Assignee Failed : " . $e->getMessage());
89
        }
90
    }
91
92
    public function issue()
93
    {
94
        $issueKey = "TEST-879";
95
96
        try {            
97
            $issueField = new IssueField(true);
98
        
99
            $issueField->setAssigneeName("admin")
100
                ->setPriorityName("Blocker")
101
                ->setIssueType("Task")
102
                ->addLabel("test-label-first")
103
                ->addLabel("test-label-second")
104
                ->addVersion("1.0.1")
105
                ->addVersion("1.0.2")
106
                ->setDescription("This is a shorthand for a set operation on the summary field");
107
        
108
            // optionally set some query params
109
            $editParams = [
110
                'notifyUsers' => false,
111
            ];
112
        
113
            $issueService = new IssueService();
114
        
115
            // You can set the $paramArray param to disable notifications in example
116
            $ret = $issueService->update($issueKey, $issueField, $editParams);
117
        
118
            var_dump($ret);
0 ignored issues
show
Security Debugging Code introduced by
var_dump($ret); looks like debug code. Are you sure you do not want to remove it? This might expose sensitive data.
Loading history...
119
        } catch (SenhorVerdugoException $e) {
0 ignored issues
show
Bug introduced by
The class Integrations\Connectors\...\SenhorVerdugoException does not exist. Did you forget a USE statement, or did you not list all dependencies?

Scrutinizer analyzes your composer.json/composer.lock file if available to determine the classes, and functions that are defined by your dependencies.

It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.

Loading history...
120
            $this->assertTrue(false, "update Failed : " . $e->getMessage());
121
        }
122
    }
123
124
    public function project(ProjectModel $project)
125
    {
126
        try {
127
            $p = new Project();
128
129
            $p->setName('Updated Example')
130
                ->setProjectTypeKey('software')
131
                ->setProjectTemplateKey('com.atlassian.SenhorVerdugo-software-project-templates:SenhorVerdugo-software-project-management')
132
                ->setDescription('Updated Example Project description')
133
                ->setLead('new-leader')
134
                ->setUrl('http://new.example.com')
135
                ->setAssigneeType('UNASSIGNED');
136
137
            $proj = new ProjectService();
138
139
            $pj = $proj->updateProject($p, 'EX');
140
        
141
            var_dump($pj);
0 ignored issues
show
Security Debugging Code introduced by
var_dump($pj); looks like debug code. Are you sure you do not want to remove it? This might expose sensitive data.
Loading history...
142
        } catch (SenhorVerdugoException $e) {
0 ignored issues
show
Bug introduced by
The class Integrations\Connectors\...\SenhorVerdugoException does not exist. Did you forget a USE statement, or did you not list all dependencies?

Scrutinizer analyzes your composer.json/composer.lock file if available to determine the classes, and functions that are defined by your dependencies.

It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.

Loading history...
143
            print("Error Occured! " . $e->getMessage());
144
        }
145
    }
146
}
147