Conditions | 4 |
Paths | 4 |
Total Lines | 51 |
Code Lines | 30 |
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 |
||
25 | public function index() |
||
26 | { |
||
27 | $this->load->language('account/success'); |
||
28 | |||
29 | $this->document->setTitle($this->language->get('heading_title')); |
||
30 | |||
31 | $data['breadcrumbs'] = array(); |
||
32 | |||
33 | $data['breadcrumbs'][] = array( |
||
34 | 'text' => $this->language->get('text_home'), |
||
35 | 'href' => $this->url->link('common/home') |
||
36 | ); |
||
37 | |||
38 | $data['breadcrumbs'][] = array( |
||
39 | 'text' => $this->language->get('text_account'), |
||
40 | 'href' => $this->url->link('account/account', '', true) |
||
41 | ); |
||
42 | |||
43 | $data['breadcrumbs'][] = array( |
||
44 | 'text' => $this->language->get('text_success'), |
||
45 | 'href' => $this->url->link('account/success') |
||
46 | ); |
||
47 | |||
48 | $data['heading_title'] = $this->language->get('heading_title'); |
||
49 | |||
50 | $this->load->model('account/customer_group'); |
||
51 | |||
52 | $customer_group_info = $this->model_account_customer_group->getCustomerGroup($this->config->get('config_customer_group_id')); |
||
53 | |||
54 | if ($customer_group_info && !$customer_group_info['approval']) { |
||
55 | $data['text_message'] = sprintf($this->language->get('text_message'), $this->url->link('information/contact')); |
||
56 | } else { |
||
57 | $data['text_message'] = sprintf($this->language->get('text_approval'), $this->config->get('config_name'), $this->url->link('information/contact')); |
||
58 | } |
||
59 | |||
60 | $data['button_continue'] = $this->language->get('button_continue'); |
||
61 | |||
62 | if ($this->cart->hasProducts()) { |
||
63 | $data['continue'] = $this->url->link('checkout/cart'); |
||
64 | } else { |
||
65 | $data['continue'] = $this->url->link('account/account', '', true); |
||
66 | } |
||
67 | |||
68 | $data['column'] = $this->load->controller('common/column'); |
||
69 | |||
70 | $data['content_top'] = $this->load->controller('common/content_top'); |
||
71 | $data['content_bottom'] = $this->load->controller('common/content_bottom'); |
||
72 | $data['footer'] = $this->load->controller('common/footer'); |
||
73 | $data['header'] = $this->load->controller('common/header'); |
||
74 | |||
75 | $this->response->setOutput($this->load->view('common/success', $data)); |
||
76 | } |
||
78 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.