Conditions | 11 |
Paths | 19 |
Total Lines | 57 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
73 | public function setField($fields, $issueKey) |
||
74 | { |
||
75 | // @todo fazer aqui |
||
76 | foreach ($fields as $fieldIdentify=>$result) { |
||
77 | if (is_a($result, StdClass::class)) { |
||
78 | } |
||
79 | |||
80 | if (Str::start($fieldIdentify, 'customfield')) { |
||
81 | // @todo |
||
82 | // dd($fieldIdentify, $result); $field = Field::firstOrCreate([ |
||
83 | // 'code' => $fieldIdentify |
||
84 | // ]); |
||
85 | FieldValue::create( |
||
86 | [ |
||
87 | 'value' => $fieldIdentify, |
||
88 | 'code_field_code' => $fieldIdentify, |
||
89 | 'code_issue_id' => $issueKey, |
||
90 | ] |
||
91 | ); |
||
92 | } elseif ($fieldIdentify == 'summary') { |
||
93 | $this->title = $result; |
||
94 | } elseif ($fieldIdentify == 'description') { |
||
95 | $this->description = $result; |
||
96 | } elseif ($fieldIdentify == 'created') { |
||
97 | $this->created_at = (string) $result; |
||
98 | } elseif ($fieldIdentify == 'updated') { |
||
99 | $this->updated_at = (string) $result; |
||
100 | } elseif ($fieldIdentify == 'lastViewed') { |
||
101 | |||
102 | } elseif ($fieldIdentify == 'resolutiondate') { |
||
103 | |||
104 | |||
105 | |||
106 | |||
107 | |||
108 | |||
109 | } elseif ($fieldIdentify == 'priority') { |
||
110 | var_dump( |
||
|
|||
111 | [ |
||
112 | 'IssueModel priority', |
||
113 | $fieldIdentify, |
||
114 | $result |
||
115 | ] |
||
116 | ); |
||
117 | } else { |
||
118 | var_dump( |
||
119 | [ |
||
120 | 'IssueModel', |
||
121 | $fieldIdentify, |
||
122 | $result |
||
123 | ] |
||
124 | ); |
||
125 | } |
||
126 | } |
||
127 | |||
128 | $this->save(); |
||
129 | } |
||
130 | } |
||
131 |