Conditions | 1 |
Paths | 1 |
Total Lines | 95 |
Code Lines | 69 |
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 |
||
25 | public function getAliasesProvider() |
||
26 | { |
||
27 | return array( |
||
28 | array( |
||
29 | 'select * from (select 1) tbl', |
||
30 | 'mydb', |
||
31 | array(), |
||
32 | ), |
||
33 | array( |
||
34 | 'select i.name as `n`,abcdef gh from qwerty i', |
||
35 | 'mydb', |
||
36 | array( |
||
37 | 'mydb' => array( |
||
38 | 'alias' => null, |
||
39 | 'tables' => array( |
||
40 | 'qwerty' => array( |
||
41 | 'alias' => 'i', |
||
42 | 'columns' => array( |
||
43 | 'name' => 'n', |
||
44 | 'abcdef' => 'gh', |
||
45 | ), |
||
46 | ), |
||
47 | ), |
||
48 | ), |
||
49 | ), |
||
50 | ), |
||
51 | array( |
||
52 | 'select film_id id,title from film', |
||
53 | 'sakila', |
||
54 | array( |
||
55 | 'sakila' => array( |
||
56 | 'alias' => null, |
||
57 | 'tables' => array( |
||
58 | 'film' => array( |
||
59 | 'alias' => null, |
||
60 | 'columns' => array( |
||
61 | 'film_id' => 'id', |
||
62 | ), |
||
63 | ), |
||
64 | ), |
||
65 | ), |
||
66 | ), |
||
67 | ), |
||
68 | array( |
||
69 | 'select `sakila`.`A`.`actor_id` as aid,`F`.`film_id` `fid`,' |
||
70 | . 'last_update updated from `sakila`.actor A join `film_actor` as ' |
||
71 | . '`F` on F.actor_id = A.`actor_id`', |
||
72 | 'sakila', |
||
73 | array( |
||
74 | 'sakila' => array( |
||
75 | 'alias' => null, |
||
76 | 'tables' => array( |
||
77 | 'film_actor' => array( |
||
78 | 'alias' => 'F', |
||
79 | 'columns' => array( |
||
80 | 'film_id' => 'fid', |
||
81 | 'last_update' => 'updated', |
||
82 | ), |
||
83 | ), |
||
84 | 'actor' => array( |
||
85 | 'alias' => 'A', |
||
86 | 'columns' => array( |
||
87 | 'actor_id' => 'aid', |
||
88 | 'last_update' => 'updated', |
||
89 | ), |
||
90 | ), |
||
91 | ), |
||
92 | ), |
||
93 | ), |
||
94 | ), |
||
95 | array( |
||
96 | 'SELECT film_id FROM (SELECT * FROM film) as f;', |
||
97 | 'sakila', |
||
98 | array(), |
||
99 | ), |
||
100 | array( |
||
101 | '', |
||
102 | null, |
||
103 | array(), |
||
104 | ), |
||
105 | array( |
||
106 | 'SELECT 1', |
||
107 | null, |
||
108 | array(), |
||
109 | ), |
||
110 | array( |
||
111 | 'SELECT * FROM orders AS ord WHERE 1', |
||
112 | 'db', |
||
113 | array( |
||
114 | 'db' => array( |
||
115 | 'alias' => null, |
||
116 | 'tables' => array( |
||
117 | 'orders' => array( |
||
118 | 'alias' => 'ord', |
||
119 | 'columns' => array(), |
||
120 | ), |
||
128 |