| Conditions | 2 |
| Paths | 2 |
| Total Lines | 51 |
| Code Lines | 34 |
| 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 |
||
| 76 | protected function createContactForm() |
||
| 77 | { |
||
| 78 | $form = UserDefinedForm::create(array( |
||
| 79 | 'Title' => 'Contact', |
||
| 80 | 'URLSegment' => 'contact', |
||
| 81 | 'Content' => '<p>$UserDefinedForm</p>', |
||
| 82 | 'SubmitButtonText' => 'Submit', |
||
| 83 | 'ClearButtonText' => 'Clear', |
||
| 84 | 'OnCompleteMessage' => "<p>Thanks, we've received your submission and will be in touch shortly.</p>", |
||
| 85 | 'EnableLiveValidation' => true |
||
| 86 | )); |
||
| 87 | |||
| 88 | $form->write(); |
||
| 89 | |||
| 90 | // Add form fields |
||
| 91 | $fields = array( |
||
| 92 | EditableFormStep::create(array( |
||
| 93 | 'Title' => _t('EditableFormStep.TITLE_FIRST', 'First Page') |
||
| 94 | )), |
||
| 95 | EditableTextField::create(array( |
||
| 96 | 'Title' => 'Name', |
||
| 97 | 'Required' => true, |
||
| 98 | 'RightTitle' => 'Please enter your first and last name' |
||
| 99 | )), |
||
| 100 | EditableEmailField::create(array( |
||
| 101 | 'Title' => Email::class, |
||
| 102 | 'Required' => true, |
||
| 103 | 'Placeholder' => '[email protected]' |
||
| 104 | )), |
||
| 105 | EditableTextField::create(array( |
||
| 106 | 'Title' => 'Subject' |
||
| 107 | )), |
||
| 108 | EditableTextField::create(array( |
||
| 109 | 'Title' => 'Message', |
||
| 110 | 'Required' => true, |
||
| 111 | 'Rows' => 5 |
||
| 112 | )) |
||
| 113 | ); |
||
| 114 | |||
| 115 | foreach ($fields as $field) { |
||
| 116 | $field->write(); |
||
| 117 | $form->Fields()->add($field); |
||
| 118 | $field->publish('Stage', 'Live'); |
||
| 119 | } |
||
| 120 | |||
| 121 | $form->publish('Stage', 'Live'); |
||
| 122 | $form->flushCache(); |
||
| 123 | |||
| 124 | $this->output(' + Created "contact" UserDefinedForm page'); |
||
| 125 | |||
| 126 | return $this; |
||
| 127 | } |
||
| 147 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths