| Conditions | 1 |
| Paths | 1 |
| Total Lines | 54 |
| Code Lines | 41 |
| 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 |
||
| 39 | public function options() { |
||
| 40 | |||
| 41 | $options = array( |
||
| 42 | static::$type . '_repeatable' => array( |
||
| 43 | 'label' => __( 'Repeatable Field', 'pods' ), |
||
| 44 | 'default' => 0, |
||
| 45 | 'type' => 'boolean', |
||
| 46 | 'help' => __( 'Making a field repeatable will add controls next to the field which allows users to Add/Remove/Reorder additional values. These values are saved in the database as an array, so searching and filtering by them may require further adjustments".', 'pods' ), |
||
| 47 | 'boolean_yes_label' => '', |
||
| 48 | 'dependency' => true, |
||
| 49 | 'developer_mode' => true, |
||
| 50 | ), |
||
| 51 | 'output_options' => array( |
||
| 52 | 'label' => __( 'Output Options', 'pods' ), |
||
| 53 | 'group' => array( |
||
| 54 | static::$type . '_allow_shortcode' => array( |
||
| 55 | 'label' => __( 'Allow Shortcodes?', 'pods' ), |
||
| 56 | 'default' => 0, |
||
| 57 | 'type' => 'boolean', |
||
| 58 | 'dependency' => true, |
||
| 59 | ), |
||
| 60 | static::$type . '_allow_html' => array( |
||
| 61 | 'label' => __( 'Allow HTML?', 'pods' ), |
||
| 62 | 'default' => 0, |
||
| 63 | 'type' => 'boolean', |
||
| 64 | 'dependency' => true, |
||
| 65 | ), |
||
| 66 | ), |
||
| 67 | ), |
||
| 68 | static::$type . '_allowed_html_tags' => array( |
||
| 69 | 'label' => __( 'Allowed HTML Tags', 'pods' ), |
||
| 70 | 'depends-on' => array( static::$type . '_allow_html' => true ), |
||
| 71 | 'default' => 'strong em a ul ol li b i', |
||
| 72 | 'type' => 'text', |
||
| 73 | ), |
||
| 74 | static::$type . '_max_length' => array( |
||
| 75 | 'label' => __( 'Maximum Length', 'pods' ), |
||
| 76 | 'default' => 255, |
||
| 77 | 'type' => 'number', |
||
| 78 | 'help' => __( 'Set to -1 for no limit', 'pods' ), |
||
| 79 | ), |
||
| 80 | static::$type . '_placeholder' => array( |
||
| 81 | 'label' => __( 'HTML Placeholder', 'pods' ), |
||
| 82 | 'default' => '', |
||
| 83 | 'type' => 'text', |
||
| 84 | 'help' => array( |
||
| 85 | __( 'Placeholders can provide instructions or an example of the required data format for a field. Please note: It is not a replacement for labels or description text, and it is less accessible for people using screen readers.', 'pods' ), |
||
| 86 | 'https://www.w3.org/WAI/tutorials/forms/instructions/#placeholder-text', |
||
| 87 | ), |
||
| 88 | ), |
||
| 89 | ); |
||
| 90 | |||
| 91 | return $options; |
||
| 92 | } |
||
| 93 | |||
| 207 |
Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a
@returnannotation as described here.