Conditions | 4 |
Paths | 6 |
Total Lines | 53 |
Code Lines | 38 |
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('common/footer'); |
||
28 | |||
29 | $data['scripts'] = $this->document->getScripts('footer'); |
||
30 | |||
31 | $data['text_information'] = $this->language->get('text_information'); |
||
32 | $data['text_service'] = $this->language->get('text_service'); |
||
33 | $data['text_extra'] = $this->language->get('text_extra'); |
||
34 | $data['text_contact'] = $this->language->get('text_contact'); |
||
35 | $data['text_manufacturer'] = $this->language->get('text_manufacturer'); |
||
36 | $data['text_special'] = $this->language->get('text_special'); |
||
37 | $data['text_bestseller'] = $this->language->get('text_bestseller'); |
||
38 | $data['text_mostviewed'] = $this->language->get('text_mostviewed'); |
||
39 | $data['text_latest'] = $this->language->get('text_latest'); |
||
40 | $data['text_account'] = $this->language->get('text_account'); |
||
41 | $data['text_order'] = $this->language->get('text_order'); |
||
42 | $data['text_newsletter'] = $this->language->get('text_newsletter'); |
||
43 | $data['text_powered'] = $this->language->get('text_powered'); |
||
44 | |||
45 | $data['store_name'] = $this->config->get('config_name'); |
||
46 | $data['store_year'] = date('Y', time()); |
||
47 | |||
48 | if (is_file($_SERVER['DOCUMENT_ROOT'] . '/public_html/assets/images/' . $this->config->get('config_logo'))) { |
||
49 | $data['logo'] = '/public_html/assets/images/' . $this->config->get('config_logo'); |
||
50 | } else { |
||
51 | $data['logo'] = ''; |
||
52 | } |
||
53 | |||
54 | $this->load->model('catalog/information'); |
||
55 | |||
56 | $data['informations'] = array(); |
||
57 | |||
58 | foreach ($this->model_catalog_information->getInformations() as $result) { |
||
59 | if ($result['bottom']) { |
||
60 | $data['informations'][] = array( |
||
61 | 'title' => $result['title'], |
||
62 | 'href' => $this->url->link('information/information', 'information_id=' . $result['information_id']) |
||
63 | ); |
||
64 | } |
||
65 | } |
||
66 | |||
67 | $data['contact'] = $this->url->link('information/contact'); |
||
68 | $data['manufacturer'] = $this->url->link('product/manufacturer'); |
||
69 | $data['special'] = $this->url->link('product/special'); |
||
70 | $data['bestseller'] = $this->url->link('product/bestseller'); |
||
71 | $data['mostviewed'] = $this->url->link('product/mostviewed'); |
||
72 | $data['latest'] = $this->url->link('product/latest'); |
||
73 | $data['account'] = $this->url->link('account/account', '', true); |
||
74 | $data['order'] = $this->url->link('account/order', '', true); |
||
75 | $data['newsletter'] = $this->url->link('account/newsletter', '', true); |
||
76 | |||
77 | return $this->load->view('common/footer', $data); |
||
78 | } |
||
80 |
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.