| Conditions | 1 | 
| Paths | 1 | 
| Total Lines | 86 | 
| Code Lines | 72 | 
| 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  | 
            ||
| 48 | 		function add_template( $gallery_templates ) { | 
            ||
| 49 | $gallery_templates[] = array(  | 
            ||
| 50 | 'slug' => 'justified',  | 
            ||
| 51 | 'name' => __( 'Justified Gallery', 'foogallery' ),  | 
            ||
| 52 | 'lazyload_support' => true,  | 
            ||
| 53 | 'fields' => array(  | 
            ||
| 54 | array(  | 
            ||
| 55 | 'id' => 'thumb_height',  | 
            ||
| 56 | 'title' => __( 'Thumb Height', 'foogallery' ),  | 
            ||
| 57 | 'desc' => __( 'Choose the height of your thumbnails. Thumbnails will be generated on the fly and cached once generated', 'foogallery' ),  | 
            ||
| 58 | 'section' => __( 'General', 'foogallery' ),  | 
            ||
| 59 | 'type' => 'number',  | 
            ||
| 60 | 'class' => 'small-text',  | 
            ||
| 61 | 'default' => 250,  | 
            ||
| 62 | 'step' => '10',  | 
            ||
| 63 | 'min' => '0',  | 
            ||
| 64 | 'row_data'=> array(  | 
            ||
| 65 | 'data-foogallery-preview' => 'shortcode'  | 
            ||
| 66 | )  | 
            ||
| 67 | ),  | 
            ||
| 68 | array(  | 
            ||
| 69 | 'id' => 'row_height',  | 
            ||
| 70 | 'title' => __( 'Row Height', 'foogallery' ),  | 
            ||
| 71 | 'desc' => __( 'The preferred height of your gallery rows. This can be different from the thumbnail height', 'foogallery' ),  | 
            ||
| 72 | 'section' => __( 'General', 'foogallery' ),  | 
            ||
| 73 | 'type' => 'number',  | 
            ||
| 74 | 'class' => 'small-text',  | 
            ||
| 75 | 'default' => 150,  | 
            ||
| 76 | 'step' => '10',  | 
            ||
| 77 | 'min' => '0',  | 
            ||
| 78 | 'row_data'=> array(  | 
            ||
| 79 | 'data-foogallery-change-selector' => 'input',  | 
            ||
| 80 | 'data-foogallery-value-selector' => 'input',  | 
            ||
| 81 | 'data-foogallery-preview' => 'data',  | 
            ||
| 82 | )  | 
            ||
| 83 | ),  | 
            ||
| 84 | array(  | 
            ||
| 85 | 'id' => 'max_row_height',  | 
            ||
| 86 | 'title' => __( 'Max Row Height', 'foogallery' ),  | 
            ||
| 87 | 'desc' => __( 'A number (e.g 200) which specifies the maximum row height in pixels. A negative value for no limits. Alternatively, use a percentage (e.g. 200% which means that the row height cannot exceed 2 * rowHeight)', 'foogallery' ),  | 
            ||
| 88 | 'section' => __( 'General', 'foogallery' ),  | 
            ||
| 89 | 'type' => 'text',  | 
            ||
| 90 | 'class' => 'small-text',  | 
            ||
| 91 | 'default' => '200%',  | 
            ||
| 92 | 'row_data'=> array(  | 
            ||
| 93 | 'data-foogallery-change-selector' => 'input',  | 
            ||
| 94 | 'data-foogallery-value-selector' => 'input',  | 
            ||
| 95 | 'data-foogallery-preview' => 'data',  | 
            ||
| 96 | )  | 
            ||
| 97 | ),  | 
            ||
| 98 | array(  | 
            ||
| 99 | 'id' => 'margins',  | 
            ||
| 100 | 'title' => __( 'Margins', 'foogallery' ),  | 
            ||
| 101 | 'desc' => __( 'The spacing between your thumbnails.', 'foogallery' ),  | 
            ||
| 102 | 'section' => __( 'General', 'foogallery' ),  | 
            ||
| 103 | 'type' => 'number',  | 
            ||
| 104 | 'class' => 'small-text',  | 
            ||
| 105 | 'default' => 1,  | 
            ||
| 106 | 'step' => '1',  | 
            ||
| 107 | 'min' => '0',  | 
            ||
| 108 | 'row_data'=> array(  | 
            ||
| 109 | 'data-foogallery-change-selector' => 'input',  | 
            ||
| 110 | 'data-foogallery-value-selector' => 'input',  | 
            ||
| 111 | 'data-foogallery-preview' => 'data',  | 
            ||
| 112 | )  | 
            ||
| 113 | ),  | 
            ||
| 114 | array(  | 
            ||
| 115 | 'id' => 'thumbnail_link',  | 
            ||
| 116 | 'title' => __( 'Thumbnail Link', 'foogallery' ),  | 
            ||
| 117 | 'section' => __( 'General', 'foogallery' ),  | 
            ||
| 118 | 'default' => 'image' ,  | 
            ||
| 119 | 'type' => 'thumb_link',  | 
            ||
| 120 | 'desc' => __( 'You can choose to link each thumbnail to the full size image, or to the image\'s attachment page, or you can choose to not link to anything.', 'foogallery' ),  | 
            ||
| 121 | ),  | 
            ||
| 122 | array(  | 
            ||
| 123 | 'id' => 'lightbox',  | 
            ||
| 124 | 'title' => __( 'Lightbox', 'foogallery' ),  | 
            ||
| 125 | 'desc' => __( 'Choose which lightbox you want to display images with. The lightbox will only work if you set the thumbnail link to "Full Size Image".', 'foogallery' ),  | 
            ||
| 126 | 'section' => __( 'General', 'foogallery' ),  | 
            ||
| 127 | 'type' => 'lightbox',  | 
            ||
| 128 | ),  | 
            ||
| 129 | ),  | 
            ||
| 130 | );  | 
            ||
| 131 | |||
| 132 | return $gallery_templates;  | 
            ||
| 133 | }  | 
            ||
| 134 | |||
| 229 | }  | 
            
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.