Conditions | 2 |
Paths | 2 |
Total Lines | 105 |
Code Lines | 75 |
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 |
||
50 | public function prepend(ContainerBuilder $container) |
||
51 | { |
||
52 | if (ElasticSearchUtil::useVersion6()) { |
||
53 | $mapping = [ |
||
54 | 'mapping' => [ |
||
55 | 'root_id' => [ |
||
56 | 'type' => 'integer', |
||
57 | ], |
||
58 | 'node_id' => [ |
||
59 | 'type' => 'integer', |
||
60 | ], |
||
61 | 'nodetranslation_id' => [ |
||
62 | 'type' => 'integer', |
||
63 | ], |
||
64 | 'nodeversion_id' => [ |
||
65 | 'type' => 'integer', |
||
66 | ], |
||
67 | 'title' => [ |
||
68 | 'type' => 'text', |
||
69 | ], |
||
70 | 'slug' => [ |
||
71 | 'type' => 'text', |
||
72 | ], |
||
73 | 'type' => [ |
||
74 | 'type' => 'keyword', |
||
75 | ], |
||
76 | 'page_class' => [ |
||
77 | 'type' => 'keyword', |
||
78 | ], |
||
79 | 'content' => [ |
||
80 | 'type' => 'text', |
||
81 | ], |
||
82 | 'view_roles' => [ |
||
83 | 'type' => 'keyword', |
||
84 | ], |
||
85 | ] |
||
86 | ]; |
||
87 | } else { |
||
88 | $mapping = [ |
||
89 | 'mapping' => [ |
||
90 | 'root_id' => [ |
||
91 | 'type' => 'integer', |
||
92 | 'include_in_all' => false, |
||
93 | 'index' => 'not_analyzed' |
||
94 | ], |
||
95 | 'node_id' => [ |
||
96 | 'type' => 'integer', |
||
97 | 'include_in_all' => false, |
||
98 | 'index' => 'not_analyzed' |
||
99 | ], |
||
100 | 'nodetranslation_id' => [ |
||
101 | 'type' => 'integer', |
||
102 | 'include_in_all' => false, |
||
103 | 'index' => 'not_analyzed' |
||
104 | ], |
||
105 | 'nodeversion_id' => [ |
||
106 | 'type' => 'integer', |
||
107 | 'include_in_all' => false, |
||
108 | 'index' => 'not_analyzed' |
||
109 | ], |
||
110 | 'title' => [ |
||
111 | 'type' => 'string', |
||
112 | 'boost' => 2, |
||
113 | 'include_in_all' => true |
||
114 | ], |
||
115 | 'slug' => [ |
||
116 | 'type' => 'string', |
||
117 | 'include_in_all' => false, |
||
118 | 'index' => 'not_analyzed' |
||
119 | ], |
||
120 | 'type' => [ |
||
121 | 'type' => 'string', |
||
122 | 'include_in_all' => false, |
||
123 | 'index' => 'not_analyzed' |
||
124 | ], |
||
125 | 'page_class' => [ |
||
126 | 'type' => 'string', |
||
127 | 'include_in_all' => false, |
||
128 | 'index' => 'not_analyzed' |
||
129 | ], |
||
130 | 'content' => [ |
||
131 | 'type' => 'string', |
||
132 | 'include_in_all' => true |
||
133 | ], |
||
134 | 'created' => [ |
||
135 | 'type' => 'date', |
||
136 | 'include_in_all' => false, |
||
137 | 'index' => 'not_analyzed' |
||
138 | ], |
||
139 | 'updated' => [ |
||
140 | 'type' => 'date', |
||
141 | 'include_in_all' => false, |
||
142 | 'index' => 'not_analyzed' |
||
143 | ], |
||
144 | 'view_roles' => [ |
||
145 | 'type' => 'string', |
||
146 | 'include_in_all' => true, |
||
147 | 'index' => 'not_analyzed', |
||
148 | ], |
||
149 | ] |
||
150 | ]; |
||
151 | } |
||
152 | |||
153 | $container->prependExtensionConfig('kunstmaan_node_search', $mapping); |
||
154 | } |
||
155 | } |
||
156 |