Conditions | 4 |
Paths | 8 |
Total Lines | 71 |
Code Lines | 48 |
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 | if (!$this->customer->isLogged()) { |
||
28 | $this->session->data['redirect'] = $this->url->link('account/account', '', true); |
||
29 | |||
30 | $this->response->redirect($this->url->link('account/login', '', true)); |
||
31 | } |
||
32 | |||
33 | $this->load->language('account/account'); |
||
34 | |||
35 | $this->document->setTitle($this->language->get('heading_title')); |
||
36 | $this->document->setRobots('noindex,follow'); |
||
37 | |||
38 | $data['breadcrumbs'] = array(); |
||
39 | |||
40 | $data['breadcrumbs'][] = array( |
||
41 | 'text' => $this->language->get('text_home'), |
||
42 | 'href' => $this->url->link('common/home') |
||
43 | ); |
||
44 | |||
45 | $data['breadcrumbs'][] = array( |
||
46 | 'text' => $this->language->get('text_account'), |
||
47 | 'href' => $this->url->link('account/account', '', true) |
||
48 | ); |
||
49 | |||
50 | if (isset($this->session->data['success'])) { |
||
51 | $data['success'] = $this->session->data['success']; |
||
52 | |||
53 | unset($this->session->data['success']); |
||
54 | } else { |
||
55 | $data['success'] = ''; |
||
56 | } |
||
57 | |||
58 | $data['heading_title'] = $this->language->get('heading_title'); |
||
59 | $this->document->setRobots('noindex,follow'); |
||
60 | |||
61 | $data['text_my_account'] = $this->language->get('text_my_account'); |
||
62 | $data['text_my_orders'] = $this->language->get('text_my_orders'); |
||
63 | $data['text_my_newsletter'] = $this->language->get('text_my_newsletter'); |
||
64 | $data['text_edit'] = $this->language->get('text_edit'); |
||
65 | $data['text_password'] = $this->language->get('text_password'); |
||
66 | $data['text_address'] = $this->language->get('text_address'); |
||
67 | $data['text_order'] = $this->language->get('text_order'); |
||
68 | $data['text_download'] = $this->language->get('text_download'); |
||
69 | $data['text_reward'] = $this->language->get('text_reward'); |
||
70 | $data['text_transaction'] = $this->language->get('text_transaction'); |
||
71 | $data['text_newsletter'] = $this->language->get('text_newsletter'); |
||
72 | |||
73 | $data['edit'] = $this->url->link('account/edit', '', true); |
||
74 | $data['password'] = $this->url->link('account/password', '', true); |
||
75 | $data['address'] = $this->url->link('account/address', '', true); |
||
76 | |||
77 | $data['order'] = $this->url->link('account/order', '', true); |
||
78 | $data['download'] = $this->url->link('account/download', '', true); |
||
79 | |||
80 | if ($this->config->get('reward_status')) { |
||
81 | $data['reward'] = $this->url->link('account/reward', '', true); |
||
82 | } else { |
||
83 | $data['reward'] = ''; |
||
84 | } |
||
85 | |||
86 | $data['transaction'] = $this->url->link('account/transaction', '', true); |
||
87 | $data['newsletter'] = $this->url->link('account/newsletter', '', true); |
||
88 | |||
89 | $data['column'] = $this->load->controller('common/column'); |
||
90 | $data['content_top'] = $this->load->controller('common/content_top'); |
||
91 | $data['content_bottom'] = $this->load->controller('common/content_bottom'); |
||
92 | $data['footer'] = $this->load->controller('common/footer'); |
||
93 | $data['header'] = $this->load->controller('common/header'); |
||
94 | |||
95 | $this->response->setOutput($this->load->view('account/account', $data)); |
||
96 | } |
||
125 |
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.