LoggingFormatter.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. /**
  12. * Used to format logging messages during the compilation.
  13. *
  14. * @author Johannes M. Schmitt <schmittjoh@gmail.com>
  15. */
  16. class LoggingFormatter
  17. {
  18. public function formatRemoveService(CompilerPassInterface $pass, $id, $reason)
  19. {
  20. return $this->format($pass, sprintf('Removed service "%s"; reason: %s.', $id, $reason));
  21. }
  22. public function formatInlineService(CompilerPassInterface $pass, $id, $target)
  23. {
  24. return $this->format($pass, sprintf('Inlined service "%s" to "%s".', $id, $target));
  25. }
  26. public function formatUpdateReference(CompilerPassInterface $pass, $serviceId, $oldDestId, $newDestId)
  27. {
  28. return $this->format($pass, sprintf('Changed reference of service "%s" previously pointing to "%s" to "%s".', $serviceId, $oldDestId, $newDestId));
  29. }
  30. public function formatResolveInheritance(CompilerPassInterface $pass, $childId, $parentId)
  31. {
  32. return $this->format($pass, sprintf('Resolving inheritance for "%s" (parent: %s).', $childId, $parentId));
  33. }
  34. public function format(CompilerPassInterface $pass, $message)
  35. {
  36. return sprintf('%s: %s', \get_class($pass), $message);
  37. }
  38. }