Conditions | 1 |
Paths | 1 |
Total Lines | 70 |
Code Lines | 56 |
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 |
||
52 | public function settings( $cmb ) { |
||
53 | $cmb->add_field( |
||
54 | array( |
||
55 | 'id' => 'workout_tab_layout', |
||
56 | 'type' => 'select', |
||
57 | 'name' => __( 'Workout Tab Layout', 'lsx-health-plan' ), |
||
58 | 'description' => __( 'Choose the layout for the workouts.', 'lsx-health-plan' ), |
||
59 | 'options' => array( |
||
60 | 'table' => __( 'Table', 'lsx-health-plan' ), |
||
61 | 'list' => __( 'List', 'lsx-health-plan' ), |
||
62 | 'grid' => __( 'Grid', 'lsx-health-plan' ), |
||
63 | ), |
||
64 | ) |
||
65 | ); |
||
66 | $cmb->add_field( |
||
67 | array( |
||
68 | 'id' => 'workout_tab_link', |
||
69 | 'type' => 'select', |
||
70 | 'name' => __( 'Workout Tab Link', 'lsx-health-plan' ), |
||
71 | 'description' => __( 'Choose to show the excerpt, full content or nothing.', 'lsx-health-plan' ), |
||
72 | 'options' => array( |
||
73 | '' => __( 'None', 'lsx-health-plan' ), |
||
74 | 'single' => __( 'Single', 'lsx-health-plan' ), |
||
75 | 'modal' => __( 'Modal', 'lsx-health-plan' ), |
||
76 | ), |
||
77 | 'default' => 'modal', |
||
78 | ) |
||
79 | ); |
||
80 | $cmb->add_field( |
||
81 | array( |
||
82 | 'id' => 'workout_tab_modal_content', |
||
83 | 'type' => 'select', |
||
84 | 'name' => __( 'Modal Content', 'lsx-health-plan' ), |
||
85 | 'description' => __( 'Choose to show the excerpt, full content or nothing. For the modal content only', 'lsx-health-plan' ), |
||
86 | 'options' => array( |
||
87 | '' => __( 'None', 'lsx-health-plan' ), |
||
88 | 'excerpt' => __( 'Excerpt', 'lsx-health-plan' ), |
||
89 | 'full' => __( 'Full Content', 'lsx-health-plan' ), |
||
90 | ), |
||
91 | 'default' => '', |
||
92 | ) |
||
93 | ); |
||
94 | $cmb->add_field( |
||
95 | array( |
||
96 | 'id' => 'workout_tab_columns', |
||
97 | 'type' => 'select', |
||
98 | 'name' => __( 'Grid Columns', 'lsx-health-plan' ), |
||
99 | 'description' => __( 'If you are displaying a grid, set the amount of columns you want to use.', 'lsx-health-plan' ), |
||
100 | 'options' => array( |
||
101 | '12' => __( '1', 'lsx-health-plan' ), |
||
102 | '6' => __( '2', 'lsx-health-plan' ), |
||
103 | '4' => __( '3', 'lsx-health-plan' ), |
||
104 | '3' => __( '4', 'lsx-health-plan' ), |
||
105 | '2' => __( '6', 'lsx-health-plan' ), |
||
106 | ), |
||
107 | 'default' => '4', |
||
108 | ) |
||
109 | ); |
||
110 | $cmb->add_field( |
||
111 | array( |
||
112 | 'id' => 'workout_tab_content', |
||
113 | 'type' => 'select', |
||
114 | 'name' => __( 'Grid Content', 'lsx-health-plan' ), |
||
115 | 'description' => __( 'Choose to show the excerpt, full content or nothing. For the grid layout only', 'lsx-health-plan' ), |
||
116 | 'options' => array( |
||
117 | '' => __( 'None', 'lsx-health-plan' ), |
||
118 | 'excerpt' => __( 'Excerpt', 'lsx-health-plan' ), |
||
119 | 'full' => __( 'Full Content', 'lsx-health-plan' ), |
||
120 | ), |
||
121 | 'default' => '', |
||
122 | ) |
||
127 |