| Conditions | 11 | 
| Paths | 9 | 
| Total Lines | 43 | 
| 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  | 
            ||
| 132 | 	public function fileupload_link_atts( $link_atts, $field_compat = array(), $context = null, $additional_details = null ) { | 
            ||
| 133 | |||
| 134 | 		if ( $context && ! $context->view->settings->get( 'lightbox', false ) ) { | 
            ||
| 135 | return $link_atts;  | 
            ||
| 136 | }  | 
            ||
| 137 | |||
| 138 | // Prevent empty content from getting added to the lightbox gallery  | 
            ||
| 139 | 		if ( is_array( $additional_details ) && empty( $additional_details['file_path'] ) ) { | 
            ||
| 140 | return $link_atts;  | 
            ||
| 141 | }  | 
            ||
| 142 | |||
| 143 | // Prevent empty content from getting added to the lightbox gallery  | 
            ||
| 144 | 		if ( is_array( $additional_details ) && ! empty( $additional_details['disable_lightbox'] ) ) { | 
            ||
| 145 | return $link_atts;  | 
            ||
| 146 | }  | 
            ||
| 147 | |||
| 148 | $link_atts['class'] = \GV\Utils::get( $link_atts, 'class' ) . ' gravityview-fancybox';  | 
            ||
| 149 | |||
| 150 | $link_atts['class'] = gravityview_sanitize_html_class( $link_atts['class'] );  | 
            ||
| 151 | |||
| 152 | 		if ( $context && ! empty( $context->field->field ) ) { | 
            ||
| 153 | 			if ( $context->field->field->multipleFiles ) { | 
            ||
| 154 | $entry = $context->entry->as_entry();  | 
            ||
| 155 | $link_atts['data-fancybox'] = 'gallery-' . sprintf( "%s-%s-%s", $entry['form_id'], $context->field->ID, $context->entry->get_slug() );  | 
            ||
| 156 | }  | 
            ||
| 157 | }  | 
            ||
| 158 | |||
| 159 | $file_path = \GV\Utils::get( $additional_details, 'file_path' );  | 
            ||
| 160 | |||
| 161 | 		if ( false !== strpos( $file_path, 'gv-iframe' ) ) { | 
            ||
| 162 | |||
| 163 | $fancybox_settings = array(  | 
            ||
| 164 | 'type' => 'iframe',  | 
            ||
| 165 | 'iframe' => array(  | 
            ||
| 166 | 'preload' => false,  | 
            ||
| 167 | ),  | 
            ||
| 168 | );  | 
            ||
| 169 | |||
| 170 | $link_atts['data-options'] = json_encode( $fancybox_settings );  | 
            ||
| 171 | }  | 
            ||
| 172 | |||
| 173 | return $link_atts;  | 
            ||
| 174 | }  | 
            ||
| 175 | |||
| 179 |