/
githubmirror
/
magento2
Обзор
Документация
Войти
/
githubmirror
/
magento2
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
2.4-develop
setup/src/Magento/Setup/Model/Description/DescriptionParagraphGenerator.php
60 строк
1 KB
Alexandra Zota
ACP2E-4019: CE copyright updates for 2.4.9-beta1
22 окт 2025, 11:23
22 окт 2025, 11:23
6c2f6e6
Код
Авторство
О чём код?
<?php /** * Copyright 2017 Adobe * All Rights Reserved. */ namespace Magento\Setup\Model\Description; /** * Generate random paragraph for description based on configuration */ class DescriptionParagraphGenerator { /** * @var \Magento\Setup\Model\Description\DescriptionSentenceGenerator */ private $sentenceGenerator; /** * @var array */ private $paragraphConfig; /** * @param \Magento\Setup\Model\Description\DescriptionSentenceGenerator $sentenceGenerator * @param array $paragraphConfig */ public function __construct( \Magento\Setup\Model\Description\DescriptionSentenceGenerator $sentenceGenerator, array $paragraphConfig ) { $this->sentenceGenerator = $sentenceGenerator; $this->paragraphConfig = $paragraphConfig; } /** * Generate paragraph for description * * @return string */ public function generate() { // mt_rand() here is not for cryptographic use. // phpcs:ignore Magento2.Security.InsecureFunction $sentencesCount = mt_rand( $this->paragraphConfig['sentences']['count-min'], $this->paragraphConfig['sentences']['count-max'] ); $sentences = ''; while ($sentencesCount) { $sentences .= $this->sentenceGenerator->generate(); $sentences .= ' '; $sentencesCount--; } $sentences = rtrim($sentences); return $sentences; } }