Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

YamlSuggestionFormatter.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\Suggestion\Formatter;
8
9 use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\Suggestion\ConfigSuggestion;
10 use Symfony\Component\Yaml\Yaml;
11
12 class YamlSuggestionFormatter implements SuggestionFormatterInterface
13 {
14 public function format(ConfigSuggestion $configSuggestion)
15 {
16 $message = $configSuggestion->getMessage();
17 $suggestion = $configSuggestion->getSuggestion();
18 if ($suggestion) {
19 $yamlConfig = Yaml::dump($suggestion, 8);
20 if (\PHP_SAPI !== 'cli') {
21 $yamlConfig = "<pre>$yamlConfig</pre>";
22 }
23
24 return <<<EOT
25 {$message}
26
27
28 Example:
29 ========
30
31 $yamlConfig
32 EOT;
33 }
34
35 return $message;
36 }
37 }
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\Suggestion\Formatter\YamlSuggestionFormatter
Definition: YamlSuggestionFormatter.php:13
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\Suggestion\Formatter\YamlSuggestionFormatter\format
format(ConfigSuggestion $configSuggestion)
Definition: YamlSuggestionFormatter.php:14
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\Suggestion\ConfigSuggestion
ConfigSuggestion is a value object holding a suggestion change for semantic configuration.
Definition: ConfigSuggestion.php:14
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\Suggestion\ConfigSuggestion\getSuggestion
getSuggestion()
Definition: ConfigSuggestion.php:68
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\Suggestion\ConfigSuggestion\getMessage
getMessage()
Definition: ConfigSuggestion.php:52
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\Suggestion\Formatter\SuggestionFormatterInterface
Interface for ConfigSuggestion formatters.
Definition: SuggestionFormatterInterface.php:18
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\Suggestion\Formatter
Definition: SuggestionFormatterInterface.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.