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
12namespace Symfony\Component\DependencyInjection\Compiler;
13
14@trigger_error('The '.__NAMESPACE__.'\LoggingFormatter class is deprecated since Symfony 3.3 and will be removed in 4.0. Use the ContainerBuilder::log() method instead.', E_USER_DEPRECATED);
15
16/**
17 * Used to format logging messages during the compilation.
18 *
19 * @author Johannes M. Schmitt <schmittjoh@gmail.com>
20 *
21 * @deprecated since version 3.3, to be removed in 4.0. Use the ContainerBuilder::log() method instead.
22 */
23class LoggingFormatter
24{
25    public function formatRemoveService(CompilerPassInterface $pass, $id, $reason)
26    {
27        return $this->format($pass, sprintf('Removed service "%s"; reason: %s.', $id, $reason));
28    }
29
30    public function formatInlineService(CompilerPassInterface $pass, $id, $target)
31    {
32        return $this->format($pass, sprintf('Inlined service "%s" to "%s".', $id, $target));
33    }
34
35    public function formatUpdateReference(CompilerPassInterface $pass, $serviceId, $oldDestId, $newDestId)
36    {
37        return $this->format($pass, sprintf('Changed reference of service "%s" previously pointing to "%s" to "%s".', $serviceId, $oldDestId, $newDestId));
38    }
39
40    public function formatResolveInheritance(CompilerPassInterface $pass, $childId, $parentId)
41    {
42        return $this->format($pass, sprintf('Resolving inheritance for "%s" (parent: %s).', $childId, $parentId));
43    }
44
45    public function formatUnusedAutowiringPatterns(CompilerPassInterface $pass, $id, array $patterns)
46    {
47        return $this->format($pass, sprintf('Autowiring\'s patterns "%s" for service "%s" don\'t match any method.', implode('", "', $patterns), $id));
48    }
49
50    public function format(CompilerPassInterface $pass, $message)
51    {
52        return sprintf('%s: %s', \get_class($pass), $message);
53    }
54}
55