![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/magento2-base/setup/src/Magento/Setup/Fixtures/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Setup\Fixtures; use Symfony\Component\Console\Output\OutputInterface; /** * @SuppressWarnings(PHPMD.NumberOfChildren) */ abstract class Fixture { /** * @var int */ protected $priority; /** * @var FixtureModel */ protected $fixtureModel; /** * @param FixtureModel $fixtureModel */ public function __construct(FixtureModel $fixtureModel) { $this->fixtureModel = $fixtureModel; } /** * Execute fixture * * @return void */ abstract public function execute(); /** * Get fixture action description * * @return string */ abstract public function getActionTitle(); /** * Print information about generated fixture. Print fixture label and amount of generated items * * @param OutputInterface $output * @return void */ public function printInfo(OutputInterface $output) { foreach ($this->introduceParamLabels() as $configName => $label) { $configValue = $this->fixtureModel->getValue($configName); $generationCount = is_array($configValue) === true ? count($configValue[array_keys($configValue)[0]]) : $configValue; if (!empty($generationCount)) { $output->writeln('<info> |- ' . $label . ': ' . $generationCount . '</info>'); } } } /** * Introduce parameters labels * * @return array */ abstract public function introduceParamLabels(); /** * Get fixture priority * * @return int */ public function getPriority() { return $this->priority; } }