Create a Custom Entity/Node Title in Drupal 7

Tags: 

<?php
$brand = '[node:field_med_brand_name]';
$medical = '[node:field_med_medical_name]';
$both = '[node:field_med_brand_name] ([node:field_med_medical_name])';
if(empty($medical)) {
  return "$brand";
} else {
  return "$both";
}
?>