@Tobur    isset($entityNames) && !empty($entityNames) 
The first operand is unnecessary, as if value is not empty it is always set.