I can't remove 24th line because in this case error can happend in 26th line. It will help us if ...[$user->getUsername()]['hosts'] == ''