Why don't you let the '$server' be injected via the constructor as it was before ?