| Conditions | 1 |
| Paths | 1 |
| Total Lines | 88 |
| Code Lines | 61 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| 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 |
||
| 32 | public function init() |
||
| 33 | { |
||
| 34 | $this->setName('preferredJob') |
||
| 35 | ->setHydrator(new EntityHydrator()) |
||
| 36 | ->setObject(new PreferredJob()) |
||
| 37 | ->setLabel('Desired Employment'); |
||
| 38 | |||
| 39 | $this->add( |
||
| 40 | array( |
||
| 41 | 'name' => 'typeOfApplication', |
||
| 42 | 'type' => 'select', |
||
| 43 | 'options' => [ |
||
| 44 | 'value_options' => self::$typoOfApplicationOptions, |
||
| 45 | 'label' => /*@translate */ 'desired type of work', |
||
| 46 | 'description' => /*@translate*/ 'Do you want to work permanently or temporary?', |
||
| 47 | ], |
||
| 48 | 'attributes' => array( |
||
| 49 | 'title' => /*@translate */ 'please describe your position', |
||
| 50 | 'description' => 'what kind of ', |
||
| 51 | 'data-placeholder' => /*@translate*/ 'please select', |
||
| 52 | 'data-allowclear' => 'false', |
||
| 53 | 'data-searchbox' => -1, |
||
| 54 | 'multiple' => true, |
||
| 55 | 'data-width' => '100%', |
||
| 56 | ), |
||
| 57 | ) |
||
| 58 | ); |
||
| 59 | |||
| 60 | $this->add( |
||
| 61 | array( |
||
| 62 | 'name' => 'desiredJob', |
||
| 63 | 'type' => 'Text', |
||
| 64 | 'options' => array( |
||
| 65 | 'label' => /*@translate */ 'desired job position', |
||
| 66 | 'description' => /*@translate*/ 'Enter the title of your desired job. Eg. "Software Developer" or "Customer Service Representative"', |
||
| 67 | ), |
||
| 68 | 'attributes' => array( |
||
| 69 | 'title' => /*@translate */ 'please describe your position', |
||
| 70 | ), |
||
| 71 | ) |
||
| 72 | ); |
||
| 73 | |||
| 74 | $this->add( |
||
| 75 | array( |
||
| 76 | 'name' => 'desiredLocations', |
||
| 77 | 'type' => 'Location', |
||
| 78 | 'options' => array( |
||
| 79 | 'label' => /*@translate */ 'desired job location', |
||
| 80 | 'description' => /*@translate*/ 'Where do you want to work?', |
||
| 81 | ), |
||
| 82 | 'attributes' => array( |
||
| 83 | 'title' => /*@translate */ 'please describe your position', |
||
| 84 | ), |
||
| 85 | ) |
||
| 86 | ); |
||
| 87 | |||
| 88 | $this->add( |
||
| 89 | array( |
||
| 90 | 'name' => 'willingnessToTravel', |
||
| 91 | 'type' => 'Select', |
||
| 92 | 'options' => array( |
||
| 93 | 'value_options' => self::$willingnessToTravelOptions, |
||
| 94 | 'label' => /*@translate*/ 'Willingness to travel', |
||
| 95 | 'description' => /*@translate*/ 'Enter your willingness to travel.', |
||
| 96 | ), |
||
| 97 | 'attributes' => array( |
||
| 98 | 'data-placeholder' => /*@translate*/ 'please select', |
||
| 99 | 'data-allowclear' => 'false', |
||
| 100 | 'data-searchbox' => -1, |
||
| 101 | 'data-width' => '100%' |
||
| 102 | ), |
||
| 103 | ) |
||
| 104 | ); |
||
| 105 | |||
| 106 | $this->add( |
||
| 107 | array( |
||
| 108 | 'name' => 'expectedSalary', |
||
| 109 | 'type' => 'Text', |
||
| 110 | 'options' => array( |
||
| 111 | 'label' => /*@translate */ 'expected Salary', |
||
| 112 | 'description' => /*@translate*/ 'What is your expected Salary?', |
||
| 113 | ), |
||
| 114 | 'attributes' => array( |
||
| 115 | 'title' => /*@translate */ 'please describe your position', |
||
| 116 | ), |
||
| 117 | ) |
||
| 118 | ); |
||
| 119 | } |
||
| 120 | } |
||
| 121 |