Conditions | 1 |
Paths | 1 |
Total Lines | 46 |
Code Lines | 31 |
Lines | 46 |
Ratio | 100 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
19 | View Code Duplication | public function init() |
|
|
|||
20 | { |
||
21 | $this->addTextElement( |
||
22 | 'Search', |
||
23 | /*@translate*/ |
||
24 | 'Search for Applicant Name' |
||
25 | ); |
||
26 | |||
27 | $this->add( |
||
28 | array( |
||
29 | 'name' => 'l', |
||
30 | 'type' => 'Location', |
||
31 | 'options' => array( |
||
32 | 'label' => /*@translate*/ |
||
33 | 'Location', |
||
34 | 'engine_type' => $this->locationEngineType, |
||
35 | ), |
||
36 | ) |
||
37 | ); |
||
38 | |||
39 | $this->add( |
||
40 | array( |
||
41 | 'name' => 'd', |
||
42 | 'type' => 'Zend\Form\Element\Select', |
||
43 | 'options' => array( |
||
44 | 'label' => /*@translate*/ |
||
45 | 'Distance', |
||
46 | 'value_options' => [ |
||
47 | '5' => '5 km', |
||
48 | '10' => '10 km', |
||
49 | '20' => '20 km', |
||
50 | '50' => '50 km', |
||
51 | '100' => '100 km' |
||
52 | ], |
||
53 | |||
54 | ), |
||
55 | 'attributes' => [ |
||
56 | 'value' => '10', // default distance |
||
57 | 'data-searchbox' => -1, // hide the search box |
||
58 | 'data-allowclear' => 'false', // allow to clear a selected value |
||
59 | 'data-placeholder' => /*@translate*/ |
||
60 | 'Distance', |
||
61 | ] |
||
62 | ) |
||
63 | ); |
||
64 | } |
||
65 | } |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.