8000 Create ParameterResolverInterface · symfony/symfony@a06941d · GitHub
[go: up one dir, main page]

Skip to content

Commit a06941d

Browse files
committed
Create ParameterResolverInterface
1 parent eb2b7f7 commit a06941d

File tree

2 files changed

+57
-23
lines changed

2 files changed

+57
-23
lines changed

src/Symfony/Component/DependencyInjection/ParameterBag/ParameterResolver.php

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@
1616
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
1717

1818
/**
19-
* Replaces parameter placeholders (%name%) by their values.
19+
* {@inheritdoc}
2020
*
2121
* @author Ener-Getick <egetick@gmail.com>
2222
*/
23-
final class ParameterResolver
23+
class ParameterResolver implements ParameterResolverInterface
2424
{
2525
/**
2626
* @var callable
2727
*/
28-
private $parameterGetter;
28+
protected $parameterGetter;
2929

3030
/**
3131
* Constructor.
@@ -38,16 +38,7 @@ public function __construct(callable $parameterGetter)
3838
}
3939

4040
/**
41-
* Replaces parameter placeholders (%name%) by their values.
42-
*
43-
* @param mixed $value A value
44-
* @param array $resolving An array of keys that are being resolved (used internally to detect circular references)
45-
*
46-
* @return mixed The resolved value
47-
*
48-
* @throws ParameterNotFoundException if a placeholder references a parameter that does not exist
49-
* @throws ParameterCircularReferenceException if a circular reference is detected
50-
* @throws RuntimeException when a given parameter has a type problem.
41+
* {@inheritdoc}
5142
*/
5243
public function resolveValue($value, array $resolving = array())
5344
{
@@ -68,16 +59,7 @@ public function resolveValue($value, array $resolving = array())
6859
}
6960

7061
/**
71-
* Resolves parameters inside a string.
72-
*
73-
* @param string $value The string to resolve
74-
* @param array $resolving An array of keys that are being resolved (used internally to detect circular references)
75-
*
76-
* @return string The resolved string
77-
*
78-
* @throws ParameterNotFoundException if a placeholder references a parameter that does not exist
79-
* @throws ParameterCircularReferenceException if a circular reference if detected
80-
* @throws RuntimeException when a given parameter has a type problem.
62+
* {@inheritdoc}
8163
*/
8264
public function resolveString($value, array $resolving = array())
8365
{
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\DependencyInjection\ParameterBag;
13+
14+
use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException;
15+
use Symfony\Component\DependencyInjection\Exception\ParameterCircularReferenceException;
16+
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
17+
18+
/**
19+
* Replaces parameter placeholders (%name%) by their values.
20+
*
21+
* @author Ener-Getick <egetick@gmail.com>
22+
*/
23+
interface ParameterResolverInterface
24+
{
25+
/**
26+
* Replaces parameter placeholders (%name%) by their values.
27+
*
28+
* @param mixed $value A value
29+
* @param array $resolving An array of keys that are being resolved (used internally to detect circular references)
30+
*
31+
* @return mixed The resolved value
32+
*
33+
* @throws ParameterNotFoundException if a placeholder references a parameter that does not exist
34+
* @throws ParameterCircularReferenceException if a circular reference is detected
35+
* @throws RuntimeException when a given parameter has a type problem.
36+
*/
37+
public function resolveValue($value, array $resolving = array());
38+
39+
/**
40+
* Resolves parameters inside a string.
41+
*
42+
* @param string $value The string to resolve
43+
* @param array $resolving An array of keys that are being resolved (used internally to detect circular references)
44+
*
45+
* @return string The resolved string
46+
*
47+
* @throws ParameterNotFoundException if a placeholder references a parameter that does not exist
48+
* @throws ParameterCircularReferenceException if a circular reference is detected
49+
* @throws RuntimeException when a given parameter has a type problem.
50+
*/
51+
public function resolveString($value, array $resolving = array());
52+
}

0 commit comments

Comments
 (0)
0