remove code duplication.
inject the pimple container as a dependency.
renamed method.