| Total Complexity | 5 |
| Total Lines | 37 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class Form |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @param string $path |
||
| 14 | * @return string |
||
| 15 | */ |
||
| 16 | public function build( $path, array $fields = [] ) |
||
| 17 | { |
||
| 18 | if( empty( $fields )) { |
||
| 19 | $fields = $this->getSettingsFields( $this->normalizeSettingsPath( $path )); |
||
| 20 | } |
||
| 21 | foreach( $fields as $name => &$field ) { |
||
| 22 | $field = wp_parse_args( $field, ['name' => $name] ); |
||
| 23 | // new Field( $field ); |
||
|
|
|||
| 24 | } |
||
| 25 | // 1. generate fields (incl default form fields) |
||
| 26 | // 2. generate form |
||
| 27 | glsr_debug( $path, $fields ); |
||
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @return array |
||
| 32 | */ |
||
| 33 | protected function getSettingsFields( $path ) |
||
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @return string |
||
| 43 | */ |
||
| 44 | protected function normalizeSettingsPath( $path ) |
||
| 47 | } |
||
| 48 | } |
||
| 49 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.