LoggingFormatter.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\DependencyInjection\Compiler;
  11. @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);
  12. /**
  13. * Used to format logging messages during the compilation.
  14. *
  15. * @author Johannes M. Schmitt <schmittjoh@gmail.com>
  16. *
  17. * @deprecated since version 3.3, to be removed in 4.0. Use the ContainerBuilder::log() method instead.
  18. */
  19. class LoggingFormatter
  20. {
  21. public function formatRemoveService(CompilerPassInterface $pass, $id, $reason)
  22. {
  23. return $this->format($pass, sprintf('Removed service "%s"; reason: %s.', $id, $reason));
  24. }
  25. public function formatInlineService(CompilerPassInterface $pass, $id, $target)
  26. {
  27. return $this->format($pass, sprintf('Inlined service "%s" to "%s".', $id, $target));
  28. }
  29. public function formatUpdateReference(CompilerPassInterface $pass, $serviceId, $oldDestId, $newDestId)
  30. {
  31. return $this->format($pass, sprintf('Changed reference of service "%s" previously pointing to "%s" to "%s".', $serviceId, $oldDestId, $newDestId));
  32. }
  33. public function formatResolveInheritance(CompilerPassInterface $pass, $childId, $parentId)
  34. {
  35. return $this->format($pass, sprintf('Resolving inheritance for "%s" (parent: %s).', $childId, $parentId));
  36. }
  37. public function formatUnusedAutowiringPatterns(CompilerPassInterface $pass, $id, array $patterns)
  38. {
  39. return $this->format($pass, sprintf('Autowiring\'s patterns "%s" for service "%s" don\'t match any method.', implode('", "', $patterns), $id));
  40. }
  41. public function format(CompilerPassInterface $pass, $message)
  42. {
  43. return sprintf('%s: %s', get_class($pass), $message);
  44. }
  45. }