Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A Practical Guide to Refactoring your PHP Code: Complex conditional example 2
if ( upload_is_valid( $settings, $key ) ) {
return '1';
function upload_is_valid( $settings, $key ) {
return isset( $settings['wp-uploads'] ) && $settings['wp-uploads'] && in_array( $key, array( 'copy-to-s3', 'serve-from-s3' ) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment