| Conditions | 1 |
| Paths | 1 |
| Total Lines | 60 |
| Code Lines | 43 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| 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 |
||
| 16 | public function __construct() { |
||
| 17 | |||
| 18 | $options = array( |
||
| 19 | 'textdomain' => 'invoicing', |
||
| 20 | 'block-icon' => 'admin-site', |
||
| 21 | 'block-category'=> 'widgets', |
||
| 22 | 'block-keywords'=> "['invoicing','buy', 'buy item', 'form']", |
||
| 23 | 'class_name' => __CLASS__, |
||
| 24 | 'base_id' => 'getpaid', |
||
| 25 | 'name' => __('Invoicing > GetPaid Button','invoicing'), |
||
| 26 | 'widget_ops' => array( |
||
| 27 | 'classname' => 'wpinv-getpaid-class wpi-g bsui', |
||
| 28 | 'description' => esc_html__('Displays a button that loads a payment form in a popup.','invoicing'), |
||
| 29 | ), |
||
| 30 | 'arguments' => array( |
||
| 31 | |||
| 32 | 'title' => array( |
||
| 33 | 'title' => __( 'Widget title', 'invoicing' ), |
||
| 34 | 'desc' => __( 'Enter widget title.', 'invoicing' ), |
||
| 35 | 'type' => 'text', |
||
| 36 | 'desc_tip' => true, |
||
| 37 | 'default' => '', |
||
| 38 | 'advanced' => false |
||
| 39 | ), |
||
| 40 | |||
| 41 | 'form' => array( |
||
| 42 | 'title' => __( 'Form', 'invoicing' ), |
||
| 43 | 'desc' => __( 'Enter a form id in case you want to display a specific payment form', 'invoicing' ), |
||
| 44 | 'type' => 'text', |
||
| 45 | 'desc_tip' => true, |
||
| 46 | 'default' => '', |
||
| 47 | 'placeholder' => __('1','invoicing'), |
||
| 48 | 'advanced' => false |
||
| 49 | ), |
||
| 50 | |||
| 51 | 'item' => array( |
||
| 52 | 'title' => __( 'Item', 'invoicing' ), |
||
| 53 | 'desc' => __( 'Enter an item id in case you want to sell an item', 'invoicing' ), |
||
| 54 | 'type' => 'text', |
||
| 55 | 'desc_tip' => true, |
||
| 56 | 'default' => '', |
||
| 57 | 'placeholder' => __('1','invoicing'), |
||
| 58 | 'advanced' => false |
||
| 59 | ), |
||
| 60 | |||
| 61 | 'button' => array( |
||
| 62 | 'title' => __( 'Button Label', 'invoicing' ), |
||
| 63 | 'desc' => __( 'Enter button label. Default "Buy Now".', 'invoicing' ), |
||
| 64 | 'type' => 'text', |
||
| 65 | 'desc_tip' => true, |
||
| 66 | 'default' => __( 'Buy Now', 'invoicing' ), |
||
| 67 | 'advanced' => false |
||
| 68 | ) |
||
| 69 | |||
| 70 | ) |
||
| 71 | |||
| 72 | ); |
||
| 73 | |||
| 74 | |||
| 75 | parent::__construct( $options ); |
||
| 76 | } |
||
| 160 |