ServiceProvider : refactory if condition