$part ) { $part = str_replace( '_', '-', strtolower( $part ) ); $prefix = ( $key + 1 === $count_parts ) ? '/class-' : '/'; $path .= $prefix . $part; } $path .= '.php'; if ( ! file_exists( $path ) ) { return false; } require_once $path; return true; });