Conditions | 35 |
Paths | 4096 |
Total Lines | 47 |
Lines | 18 |
Ratio | 38.3 % |
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 |
||
46 | private function addDisabledCsrfUrls() { |
||
47 | |||
48 | // Diable CSRF library form web money service |
||
49 | $ci = $this->ci; |
||
50 | View Code Duplication | if ($ci->uri->segment(1) == 'shop' && $ci->uri->segment(2) == 'cart' && $ci->uri->segment(3) == 'view' && $ci->input->get('result') == 'true' && $ci->input->get('pm') > 0) { |
|
51 | define('ICMS_DISBALE_CSRF', true); |
||
52 | } |
||
53 | // Support for robokassa |
||
54 | View Code Duplication | if ($ci->uri->segment(1) == 'shop' && $ci->uri->segment(2) == 'cart' && $ci->uri->segment(3) == 'view' && $ci->input->get('getResult') == 'true') { |
|
55 | define('ICMS_DISBALE_CSRF', true); |
||
56 | } |
||
57 | if ($ci->uri->segment(1) == 'exchange') { |
||
58 | define('ICMS_DISBALE_CSRF', true); |
||
59 | } |
||
60 | // Support for privat |
||
61 | if ($ci->uri->segment(1) == 'shop' && $ci->uri->segment(2) == 'order' && $ci->uri->segment(3) == 'view' && $ci->input->post()) { |
||
62 | define('ICMS_DISBALE_CSRF', true); |
||
63 | } |
||
64 | View Code Duplication | if ($ci->uri->segment(1) == 'shop' && $ci->uri->segment(2) == 'cart' && $ci->uri->segment(3) == 'view' && $ci->input->get('succes') == 'true') { |
|
65 | define('ICMS_DISBALE_CSRF', true); |
||
66 | } |
||
67 | View Code Duplication | if ($ci->uri->segment(1) == 'shop' && $ci->uri->segment(2) == 'cart' && $ci->uri->segment(3) == 'view' && $ci->input->get('fail') == 'true') { |
|
68 | define('ICMS_DISBALE_CSRF', true); |
||
69 | } |
||
70 | View Code Duplication | if ($ci->input->server('HTTP_REFERER') AND strpos($ci->input->server('HTTP_REFERER') . '', 'facebook.com')) { |
|
71 | define('ICMS_DISBALE_CSRF', true); |
||
72 | } |
||
73 | View Code Duplication | if ($ci->input->server('HTTP_REFERER') AND strpos($ci->input->server('HTTP_REFERER') . '', 'facebook.com')) { |
|
74 | define('ICMS_DISBALE_CSRF', true); |
||
75 | } |
||
76 | // Support for privat |
||
77 | |||
78 | if ($ci->uri->segment(1) == 'shop' && $ci->uri->segment(2) == 'order' && $ci->uri->segment(3) == 'view') { |
||
79 | define('ICMS_DISBALE_CSRF', true); |
||
80 | } |
||
81 | //new payment system |
||
82 | if (preg_match('/payment_method_/i', $ci->uri->segment(1)) || preg_match('/payment_method_/i', $ci->uri->segment(2))) { |
||
83 | define('ICMS_DISBALE_CSRF', true); |
||
84 | } |
||
85 | if ($ci->uri->segment(1) == 'facebook_store' && $ci->uri->segment(2) == 'auth_from_fb_store') { |
||
86 | define('ICMS_DISBALE_CSRF', true); |
||
87 | } |
||
88 | |||
89 | if ($ci->uri->segment(4) == 'xbanners') { |
||
90 | define('ICMS_DISBALE_CSRF', true); |
||
91 | } |
||
92 | } |
||
93 | |||
182 | /* End of file lib_csfr.php */ |
If you suppress an error, we recommend checking for the error condition explicitly: