Completed
Push — feature-20rc1 ( 008ae2 )
by Rob
16:55
created

PsrFormat::interpolate()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 2
1
<?php
2
3
/*
4
 * This file is part of the `liip/LiipImagineBundle` project.
5
 *
6
 * (c) https://github.com/liip/LiipImagineBundle/graphs/contributors
7
 *
8
 * For the full copyright and license information, please view the LICENSE.md
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Liip\ImagineBundle\Log\Formatter;
13
14
/**
15
 * @author Rob Frawley 2nd <[email protected]>
16
 */
17
final class PsrFormat extends AbstractFormat
18
{
19
    /**
20
     * @param string $message
21
     * @param array  $replacements
22
     *
23
     * @return string
24
     */
25
    protected function interpolate(string $message, array $replacements): string
26
    {
27
        foreach ($this->normalizeReplacements($replacements) as $search => $replace) {
28
            $message = str_replace(sprintf('{%s}', $search), $replace, $message);
29
        }
30
31
        return $message;
32
    }
33
}
34