[DependencyInjection] Cache resolved parameter values in ParameterBag

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        |

Problem:
The ParameterBag's method 'resolveValue()' recursively resolves parameters referenced inside other parameters' values every time. However, if a parameter is referenced (i.e. %name%) two or more times inside other parameters' values, it's recursively resolved every time.

Solution:
Added a simple $resolvedParameters private field in ParameterBag to cache resolved parameters while resolving the ParameterBag.
Did some refactoring, and created a new public method 'resolveParameter($name)', that caches (and looks up) resolved parameter values before returning them.

NOTES:
- Based on 2.5 since this is not a bug fix.
- No change in behavior, and thus no new tests were created.
I think this method should be marked as ``@internal``. It is public only because we need to access it from the callback and calling private methods there requires PHP 5.4+.

someone calling this in other code can create weird issues (for instance, if you call resolveParameter in an early compiler pass and then the next compiler pass changes the parameter, the value used in the resolved ParameterBag for this parameter or any of the other parameters depending on it would be wrong.

It could even be worth making the code safe by resetting ``resolvedParameters`` to an empty array in ``set``, ``add``, ``remove`` and ``clear`` to be sure we never end up with an invalid state