Conditions | 29 |
Paths | 29 |
Total Lines | 117 |
Code Lines | 82 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 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 |
||
47 | public function construct_ajax($mode) |
||
48 | { |
||
49 | $val = $this->shoutbox->shout_manage_ajax($mode, (int) $this->request->variable('sort', 2), (int) $this->request->variable('user', 0)); |
||
50 | $data = array(); |
||
51 | |||
52 | // We have our own error handling |
||
53 | $this->db->sql_return_on_error(true); |
||
54 | |||
55 | // Permissions verification |
||
56 | if (!$this->auth->acl_get("u_shout{$val['perm']}")) |
||
57 | { |
||
58 | $this->shoutbox->shout_error("NO_VIEW{$val['privat']}_PERM"); |
||
59 | return; |
||
60 | } |
||
61 | |||
62 | switch ($mode) |
||
63 | { |
||
64 | case 'smilies': |
||
65 | $data = $this->shoutbox->shout_ajax_smilies(); |
||
66 | break; |
||
67 | |||
68 | case 'smilies_popup': |
||
69 | $data = $this->shoutbox->shout_ajax_smilies_popup((int) $this->request->variable('cat', -1)); |
||
70 | break; |
||
71 | |||
72 | case 'display_smilies': |
||
73 | $data = $this->shoutbox->shout_ajax_display_smilies((int) $this->request->variable('smiley', 0), (int) $this->request->variable('display', 3)); |
||
74 | break; |
||
75 | |||
76 | case 'user_bbcode': |
||
77 | $data = $this->shoutbox->shout_ajax_user_bbcode((string) $this->request->variable('open', ''), (string) $this->request->variable('close', ''), (int) $this->request->variable('other', 0)); |
||
78 | break; |
||
79 | |||
80 | case 'charge_bbcode': |
||
81 | $data = $this->shoutbox->shout_ajax_charge_bbcode($val['id']); |
||
82 | break; |
||
83 | |||
84 | case 'online': |
||
85 | $data = $this->shoutbox->shout_ajax_online(); |
||
86 | break; |
||
87 | |||
88 | case 'rules': |
||
89 | $data = $this->shoutbox->shout_ajax_rules($val['priv']); |
||
90 | break; |
||
91 | |||
92 | case 'preview_rules': |
||
93 | $data = $this->shoutbox->shout_ajax_preview_rules((string) $this->request->variable('content', '', true)); |
||
94 | break; |
||
95 | |||
96 | case 'date_format': |
||
97 | $data = $this->shoutbox->shout_ajax_date_format((string) $this->request->variable('date', '', true)); |
||
98 | break; |
||
99 | |||
100 | case 'action_sound': |
||
101 | $data = $this->shoutbox->shout_ajax_action_sound((int) $this->request->variable('sound', 1)); |
||
102 | break; |
||
103 | |||
104 | case 'cite': |
||
105 | $data = $this->shoutbox->shout_ajax_cite($val['id']); |
||
106 | break; |
||
107 | |||
108 | case 'action_user': |
||
109 | $data = $this->shoutbox->shout_ajax_action_user($val); |
||
110 | break; |
||
111 | |||
112 | case 'action_post': |
||
113 | $data = $this->shoutbox->shout_ajax_action_post($val, (string) $this->request->variable('message', '', true)); |
||
114 | break; |
||
115 | |||
116 | case 'action_del': |
||
117 | $data = $this->shoutbox->shout_ajax_action_del($val); |
||
118 | break; |
||
119 | |||
120 | case 'action_del_to': |
||
121 | $data = $this->shoutbox->shout_ajax_action_del_to($val); |
||
122 | break; |
||
123 | |||
124 | case 'action_remove': |
||
125 | $data = $this->shoutbox->shout_ajax_action_remove($val); |
||
126 | break; |
||
127 | |||
128 | case 'delete': |
||
129 | $data = $this->shoutbox->shout_ajax_delete($val, (int) $this->request->variable('post', 0)); |
||
130 | break; |
||
131 | |||
132 | case 'purge': |
||
133 | $data = $this->shoutbox->shout_ajax_purge($val); |
||
134 | break; |
||
135 | |||
136 | case 'purge_robot': |
||
137 | $data = $this->shoutbox->shout_ajax_purge_robot($val); |
||
138 | break; |
||
139 | |||
140 | case 'edit': |
||
141 | $data = $this->shoutbox->shout_ajax_edit($val, (int) $this->request->variable('shout_id', 0), (string) $this->request->variable('chat_message', '', true)); |
||
142 | break; |
||
143 | |||
144 | case 'post': |
||
145 | $data = $this->shoutbox->shout_ajax_post($val, (string) $this->request->variable('chat_message', '', true), (string) $this->request->variable('name', '', true), (int) $this->request->variable('cite', 0)); |
||
146 | break; |
||
147 | |||
148 | case 'check': |
||
149 | case 'check_pop': |
||
150 | case 'check_priv': |
||
151 | $data = $this->shoutbox->shout_ajax_check($val, (bool) $this->request->variable('on_bot', true)); |
||
152 | break; |
||
153 | |||
154 | case 'view': |
||
155 | case 'view_pop': |
||
156 | case 'view_priv': |
||
157 | $data = $this->shoutbox->shout_ajax_view($val, (bool) $this->request->variable('on_bot', true), (int) $this->request->variable('start', 0)); |
||
158 | break; |
||
159 | } |
||
160 | |||
161 | // Send the response to the browser now |
||
162 | $json_response = new \phpbb\json_response; |
||
163 | $json_response->send($data, true); |
||
164 | } |
||
166 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths