| Conditions | 2 |
| Paths | 2 |
| Total Lines | 104 |
| Code Lines | 77 |
| 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 | static::$type . '_editor' => array( |
||
| 52 | 'label' => __( 'Editor', 'pods' ), |
||
| 53 | 'default' => 'tinymce', |
||
| 54 | 'type' => 'pick', |
||
| 55 | 'data' => apply_filters( |
||
| 56 | 'pods_form_ui_field_wysiwyg_editors', array( |
||
| 57 | 'tinymce' => __( 'TinyMCE (WP Default)', 'pods' ), |
||
| 58 | 'cleditor' => __( 'CLEditor', 'pods' ), |
||
| 59 | ) |
||
| 60 | ), |
||
| 61 | 'dependency' => true, |
||
| 62 | ), |
||
| 63 | 'editor_options' => array( |
||
| 64 | 'label' => __( 'Editor Options', 'pods' ), |
||
| 65 | 'depends-on' => array( static::$type . '_editor' => 'tinymce' ), |
||
| 66 | 'group' => array( |
||
| 67 | static::$type . '_media_buttons' => array( |
||
| 68 | 'label' => __( 'Enable Media Buttons?', 'pods' ), |
||
| 69 | 'default' => 1, |
||
| 70 | 'type' => 'boolean', |
||
| 71 | ), |
||
| 72 | ), |
||
| 73 | ), |
||
| 74 | 'output_options' => array( |
||
| 75 | 'label' => __( 'Output Options', 'pods' ), |
||
| 76 | 'group' => array( |
||
| 77 | static::$type . '_oembed' => array( |
||
| 78 | 'label' => __( 'Enable oEmbed?', 'pods' ), |
||
| 79 | 'default' => 0, |
||
| 80 | 'type' => 'boolean', |
||
| 81 | 'help' => array( |
||
| 82 | __( 'Embed videos, images, tweets, and other content.', 'pods' ), |
||
| 83 | 'http://codex.wordpress.org/Embeds', |
||
| 84 | ), |
||
| 85 | ), |
||
| 86 | static::$type . '_wptexturize' => array( |
||
| 87 | 'label' => __( 'Enable wptexturize?', 'pods' ), |
||
| 88 | 'default' => 1, |
||
| 89 | 'type' => 'boolean', |
||
| 90 | 'help' => array( |
||
| 91 | __( 'Transforms less-beautfiul text characters into stylized equivalents.', 'pods' ), |
||
| 92 | 'http://codex.wordpress.org/Function_Reference/wptexturize', |
||
| 93 | ), |
||
| 94 | ), |
||
| 95 | static::$type . '_convert_chars' => array( |
||
| 96 | 'label' => __( 'Enable convert_chars?', 'pods' ), |
||
| 97 | 'default' => 1, |
||
| 98 | 'type' => 'boolean', |
||
| 99 | 'help' => array( |
||
| 100 | __( 'Converts text into valid XHTML and Unicode', 'pods' ), |
||
| 101 | 'http://codex.wordpress.org/Function_Reference/convert_chars', |
||
| 102 | ), |
||
| 103 | ), |
||
| 104 | static::$type . '_wpautop' => array( |
||
| 105 | 'label' => __( 'Enable wpautop?', 'pods' ), |
||
| 106 | 'default' => 1, |
||
| 107 | 'type' => 'boolean', |
||
| 108 | 'help' => array( |
||
| 109 | __( 'Changes double line-breaks in the text into HTML paragraphs', 'pods' ), |
||
| 110 | 'http://codex.wordpress.org/Function_Reference/wpautop', |
||
| 111 | ), |
||
| 112 | ), |
||
| 113 | static::$type . '_allow_shortcode' => array( |
||
| 114 | 'label' => __( 'Allow Shortcodes?', 'pods' ), |
||
| 115 | 'default' => 0, |
||
| 116 | 'type' => 'boolean', |
||
| 117 | 'dependency' => true, |
||
| 118 | 'help' => array( |
||
| 119 | __( 'Embed [shortcodes] that help transform your static content into dynamic content.', 'pods' ), |
||
| 120 | 'http://codex.wordpress.org/Shortcode_API', |
||
| 121 | ), |
||
| 122 | ), |
||
| 123 | ), |
||
| 124 | ), |
||
| 125 | static::$type . '_allowed_html_tags' => array( |
||
| 126 | 'label' => __( 'Allowed HTML Tags', 'pods' ), |
||
| 127 | 'default' => '', |
||
| 128 | 'type' => 'text', |
||
| 129 | 'help' => __( 'Format: strong em a ul ol li b i', 'pods' ), |
||
| 130 | ), |
||
| 131 | ); |
||
| 132 | |||
| 133 | if ( function_exists( 'Markdown' ) ) { |
||
| 134 | $options['output_options']['group'][ static::$type . '_allow_markdown' ] = array( |
||
| 135 | 'label' => __( 'Allow Markdown Syntax?', 'pods' ), |
||
| 136 | 'default' => 0, |
||
| 137 | 'type' => 'boolean', |
||
| 138 | ); |
||
| 139 | } |
||
| 140 | |||
| 141 | return $options; |
||
| 142 | } |
||
| 143 | |||
| 293 |
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.