/
githubmirror
/
magento2
Обзор
Документация
Войти
/
githubmirror
/
magento2
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
2.4-develop
setup/src/Magento/Setup/Model/BasePackageInfo.php
71 строка
2 KB
Alexandra Zota
ACP2E-4019: CE copyright updates for 2.4.9-beta1
22 окт 2025, 11:23
22 окт 2025, 11:23
6c2f6e6
Код
Авторство
О чём код?
<?php /** * Copyright 2016 Adobe * All Rights Reserved. */ namespace Magento\Setup\Model; use Magento\Framework\FileSystem\Directory\ReadFactory; /** * Information about the Magento base package. * */ class BasePackageInfo { const MAGENTO_BASE_PACKAGE_COMPOSER_JSON_FILE = 'magento/magento2-base/composer.json'; const COMPOSER_KEY_EXTRA = 'extra'; const COMPOSER_KEY_MAP = 'map'; /** * @var \Magento\Framework\Filesystem\Directory\ReadInterface $reader */ private $reader; /** * Constructor * * @param ReadFactory $readFactory */ public function __construct(ReadFactory $readFactory) { $this->reader = $readFactory->create(BP); } /** * Get the list of files and directory paths from magento-base extra/map section. * * @return string [] * @throws \Magento\Setup\Exception */ public function getPaths() { // Locate composer.json for magento2-base module $filesPathList = []; $vendorDir = require VENDOR_PATH; $basePackageComposerFilePath = $vendorDir . '/' . self::MAGENTO_BASE_PACKAGE_COMPOSER_JSON_FILE; if (!$this->reader->isExist($basePackageComposerFilePath)) { throw new \Magento\Setup\Exception( 'Could not locate ' . self::MAGENTO_BASE_PACKAGE_COMPOSER_JSON_FILE . ' file.' ); } if (!$this->reader->isReadable($basePackageComposerFilePath)) { throw new \Magento\Setup\Exception( 'Could not read ' . self::MAGENTO_BASE_PACKAGE_COMPOSER_JSON_FILE . ' file.' ); } // Fill array with list of files and directories from extra/map section $composerJsonFileData = json_decode($this->reader->readFile($basePackageComposerFilePath), true); if (!isset($composerJsonFileData[self::COMPOSER_KEY_EXTRA][self::COMPOSER_KEY_MAP])) { return $filesPathList; } $extraMappings = $composerJsonFileData[self::COMPOSER_KEY_EXTRA][self::COMPOSER_KEY_MAP]; foreach ($extraMappings as $map) { $filesPathList[] = $map[1]; } return $filesPathList; } }