Conditions | 1 |
Paths | 1 |
Total Lines | 90 |
Code Lines | 62 |
Lines | 0 |
Ratio | 0 % |
Changes | 4 | ||
Bugs | 2 | 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 |
||
59 | public function getCreateFromRequestData() |
||
60 | { |
||
61 | return array( |
||
62 | 'index' => array( |
||
63 | '/', |
||
64 | array('nodes' => array('/' => 'breadcrumbs._index')), |
||
65 | ), |
||
66 | 'foo' => array( |
||
67 | '/foo', |
||
68 | array( |
||
69 | 'nodes' => array( |
||
70 | '/' => 'breadcrumbs._index', |
||
71 | '/foo' => 'Foo', |
||
72 | ), |
||
73 | ), |
||
74 | ), |
||
75 | 'foo_bar' => array( |
||
76 | '/foo/bar', |
||
77 | array( |
||
78 | 'nodes' => array( |
||
79 | '/' => 'breadcrumbs._index', |
||
80 | '/foo' => 'Foo', |
||
81 | '/foo/bar' => 'bar', |
||
82 | ), |
||
83 | ), |
||
84 | ), |
||
85 | 'bar' => array( |
||
86 | '/bar/', |
||
87 | array( |
||
88 | 'nodes' => array( |
||
89 | '/' => 'breadcrumbs._index', |
||
90 | '/bar/' => 'bar', |
||
91 | ), |
||
92 | ), |
||
93 | ), |
||
94 | 'bar_show' => array( |
||
95 | '/bar/baz', |
||
96 | array( |
||
97 | 'nodes' => array( |
||
98 | '/' => 'breadcrumbs._index', |
||
99 | '/bar/' => 'bar', |
||
100 | '/bar/baz' => 'baz', |
||
101 | ), |
||
102 | ), |
||
103 | ), |
||
104 | 'bar_int_show' => array( |
||
105 | '/bar/1', |
||
106 | array( |
||
107 | 'nodes' => array( |
||
108 | '/' => 'breadcrumbs._index', |
||
109 | '/bar/' => 'bar', |
||
110 | '/bar/1' => 'breadcrumbs._bar_show', |
||
111 | ), |
||
112 | ), |
||
113 | ), |
||
114 | 'bar_action' => array( |
||
115 | '/bar/baz/edit', |
||
116 | array( |
||
117 | 'nodes' => array( |
||
118 | '/' => 'breadcrumbs._index', |
||
119 | '/bar/' => 'bar', |
||
120 | '/bar/baz' => 'baz', |
||
121 | '/bar/baz/edit' => 'edit', |
||
122 | ), |
||
123 | ), |
||
124 | ), |
||
125 | 'bar_int_action' => array( |
||
126 | '/bar/1/edit', |
||
127 | array( |
||
128 | 'nodes' => array( |
||
129 | '/' => 'breadcrumbs._index', |
||
130 | '/bar/' => 'bar', |
||
131 | '/bar/1' => 'breadcrumbs._bar_show', |
||
132 | '/bar/1/edit' => 'edit', |
||
133 | ), |
||
134 | ), |
||
135 | ), |
||
136 | 'bar_int2_action' => array( |
||
137 | '/bar/1/2', |
||
138 | array( |
||
139 | 'nodes' => array( |
||
140 | '/' => 'breadcrumbs._index', |
||
141 | '/bar/' => 'bar', |
||
142 | '/bar/1' => 'breadcrumbs._bar_show', |
||
143 | '/bar/1/2' => 'breadcrumbs._bar_action', |
||
144 | ), |
||
145 | ), |
||
146 | ), |
||
147 | ); |
||
148 | } |
||
149 | |||
188 |