[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.
use ``if`` rather than ``elseif`` as the ``if`` returns