Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Comment.php
Go to the documentation of this file.
1 <?php
7 
14 
20 class Comment implements CommentInterface
21 {
25  private $placeholder;
26 
30  private $source;
31 
37  private $typePool;
38 
44  public function __construct(
45  PlaceholderFactory $placeholderFactory,
47  TypePool $typePool = null
48  ) {
49  $this->placeholder = $placeholderFactory->create(PlaceholderFactory::TYPE_ENVIRONMENT);
50  $this->source = $source;
51  $this->typePool = $typePool ?: ObjectManager::getInstance()->get(TypePool::class);
52  }
53 
63  public function get()
64  {
65  $comments = [];
66 
67  foreach ($this->source->getExcludedFields() as $path) {
68  if ($this->typePool->isPresent($path, TypePool::TYPE_SENSITIVE)) {
69  $comments[] = $this->placeholder->generate($path) . ' for ' . $path;
70  }
71  }
72 
73  if (!empty($comments)) {
74  $comments = array_merge([
75  'Shared configuration was written to config.php and system-specific configuration to env.php.',
76  'Shared configuration file (config.php) doesn\'t contain sensitive data for security reasons.',
77  'Sensitive data can be stored in the following environment variables:'
78  ], $comments);
79  }
80 
81  return implode(PHP_EOL, $comments);
82  }
83 }
$source
Definition: source.php:23
__construct(PlaceholderFactory $placeholderFactory, DumpConfigSourceInterface $source, TypePool $typePool=null)
Definition: Comment.php:44