Display a complex data structure.

@param OutputInterface $output     An output object.
@param array           $data       The data to display.
@param string|null     $property   The property of the data to display
(a dot-separated string).
328141
public function displayData(OutputInterface $output, array $data, $property = null)
    {
        $key = null;

        if ($property) {
            $parents = explode('.', $property);
            $key = end($parents);
            $data = NestedArrayUtil::getNestedArrayValue($data, $parents, $keyExists);
            if (!$keyExists) {
                throw new \InvalidArgumentException('Property not found: ' . $property);
            }
        }

        if (!is_string($data)) {
            $output->write(Yaml::dump($data, 5, 4, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK));
        } else {
            $output->writeln($this->format($data, $key));
        }
    }
50998
public function run(InputInterface $input, OutputInterface $output)
    {
        Template::addPath(dirname(dirname(__DIR__)) .'/Views');
        $data = [
            'command' => $this->_command,
            'controllerData' => $this->_controllerData,
            'path' => $this->_path
        ];
        $links = new GenerateQuickLinks($data);
        $links->run($input, $output);
        $panel = new GenerateHeaderPanel($data);
        $panel->run($input, $output);
        $this->generateAll($input, $output);
    }
1095035
public void setOutputProperties(Properties outputProperties) {
        for (Enumeration e = outputProperties.propertyNames();
             e.hasMoreElements(); ) {
            Object key = e.nextElement();
            if (key != null) {
                String name = key.toString();
                String value = outputProperties.getProperty(name);
                if (value != null) {
                    setOutputProperty(name, value);
                }
            }
        }
    }
1122622
public function describe(OutputInterface $output, $object, array $options = [])
	{
		$this->output = $output;

		switch (true)
		{
			case $object instanceof Application:
				$this->describeJoomlaApplication($object, $options);

				break;

			case $object instanceof AbstractCommand:
				$this->describeConsoleCommand($object, $options);

				break;

			default:
				parent::describe($output, $object, $options);
		}
	}
924523
private function createOperationOutput(array &$output, OperationInterface $operation)
    {
        $operationHandler = $this->getOperationHandler($operation);

        if (!$operationHandler) {
            return;
        }

        $output[] = '';

        $urlGenerator = $this->getUrlGenerator(
            $operationHandler->extractSourceUrl($operation)
        );

        $output = array_merge(
            $output,
            $operationHandler->getOutput($operation, $urlGenerator)
        );
    }
874781
public function writeSeedOut(OutputInterface $output, $force)
    {
        $class      = $this->getClass();
        $modelClass = $this->getModelClass();

        $fileName = $class . '.php';

        list($structure, $data, $count) = $this->renderData();

        if ($count > 0) {
            $this->writeToFileFromTemplate($this->path . '/' . $fileName, 'seeder', $output, [
                'use'       => $modelClass,
                'className' => $this->getClass(),
                'tableName' => snake_case($this->table->getTableName()),
                'model'     => class_basename($modelClass),
                'structure' => var_export($structure, true),
                'count'     => $count,
            ], $force);

            $this->writeToFileFromTemplate($this->path . '/data/' . snake_case($this->table->getTableName()) . '_table_data.php', 'seederData', $output, [
                'data' => $data,
            ], $force);
        }
    }
85669
public function isOutputProperty(string $property, WriterInterface $writer) : bool
    {
        return $this->propertyHolder->isOutputProperty($property, $writer);
    }
1271064
protected function formatOutput(OutputInterface $output, ConvertedResultIterator $fields_infos)
    {
        $output->writeln(sprintf("Relation <fg=cyan>%s.%s</fg=cyan>", $this->schema, $this->relation));
        $table = (new Table($output))
            ->setHeaders(['pk', 'name', 'type', 'default', 'notnull', 'comment'])
            ;

        foreach ($fields_infos as $info) {
            $table->addRow(
                [
                    $info['is_primary'] ? '<fg=cyan>*</fg=cyan>' : '',
                    sprintf("<fg=yellow>%s</fg=yellow>", $info['name']),
                    $this->formatType($info['type']),
                    $info['default'],
                    $info['is_notnull'] ? 'yes' : 'no',
                    wordwrap($info['comment']),
                ]
            );
        }

        $table->render();
    }
41777
protected function printDbBuildVersion(OutputInterface $output) : void
    {
        $output->writeln(
            sprintf(
                '<info>Reference Database Version</info> => %s%s',
                $this->getApplication()->getDbVersions()['build.version'],
                PHP_EOL

            )
        );
    }
1057988
protected function output($message, $data = [], $code = 0)
    {
        JsonOutput::output($message, $data, $code);
        $this->getApp()->end();
    }
965828
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->startCommand($output);

        $configurationIdentifier = $input->getArgument('identifier');
        $configurationValue = json_encode($this
            ->configurationManager
            ->get($configurationIdentifier));

        $this->printMessage(
            $output,
            'Configuration',
            $configurationIdentifier . ' : "' . $configurationValue . '"'
        );

        $this->finishCommand($output);
    }
558676
public function isOutputProperty(string $property, WriterInterface $writer) : bool
    {
        if (!$this->propertyHolder->isOutputProperty($property, $writer)) {
            return false;
        }

        return in_array($property, $this->fields);
    }
464270
public function execute(InputInterface $input, OutputInterface $output)
    {
        $outputPath = DATADIR;

        $output->write(['', '  Generating install files...', ''], true);

        $this->dumpStructure($outputPath);
        $output->writeln('  Exported DB structure');

        $this->dumpData($outputPath);
        $output->write(['  Exported DB data', ''], true);
    }
965643
protected function addOutputFormatterStyles(OutputInterface $output)
    {
        foreach ($this->getOutputFormatterStyles() as $name => $style) {
            $output->getFormatter()->setStyle($name, $style);
        }
    }
962488
protected function initialize(InputInterface $input, OutputInterface $output)
    {
        $styles = [
            // ---------------------------------------
            // Style    => [ Color, BgColor, Options ]
            // ---------------------------------------
            'title'     => [ 'white', null, ['bold'] ],
            'info'      => [ 'cyan' ],
            'warn'      => [ 'yellow', null, ['bold'] ],
            'erro'      => [ 'red', null, ['bold'] ],
            'success'   => [ 'green' ],
            'failure'   => [ 'yellow' ],
            'label'     => [ 'cyan', null, ['underscore'] ],
            'comment'   => [ 'white', null, ['reverse'] ],
            'highlight' => [ 'yellow' ],
        ];

        foreach ($styles as $name => $style) {
            $output->getFormatter()->setStyle(
                $name,
                Reflection::newInstance(
                    OutputFormatterStyle::class,
                    $style
                )
            );
        }

        $this->output = new OutputStyle($input, $output);
    }
197306
public static function output($message, $data = null)
    {
        if (static::$mode == "html") {
            static::html($message, $data);
        } else {
            static::text($message, $data);
        }
    }
391077
protected function execute(InputInterface $input, OutputInterface $output)
    {
		$this->input = $input;
		$this->output = $output;
		$this->force = $input->getOption('force');
		
		$helper = $this->getHelper('question');
		
        $userQuestion = new Question('User (root): ', 'root');
		
        $passwordQuestion = new Question('Password (): ', '');
		$passwordQuestion->setHidden(true);
		$passwordQuestion->setHiddenFallback(false);

        $hostQuestion = new Question('Host (localhost): ', 'localhost');
        $driverQuestion = new Question('Driver (pdo_mysql): ', 'pdo_mysql');
		
		$user = $helper->ask($input, $output, $userQuestion);
		$password = $helper->ask($input, $output, $passwordQuestion);
		$host = $helper->ask($input, $output, $hostQuestion);
		$driver = $helper->ask($input, $output, $driverQuestion);
		
		$connectionParams = array(
			'user' => $user,
			'password' => $password,
			'host' => $host,
			'driver' => $driver
		);
		
		try {
			$conn = $this->createConnection($connectionParams);
			
			$sm = $conn->getSchemaManager();
			
			$databases = $sm->listDatabases();
			
			$question = new ChoiceQuestion(
				'Database',
				$databases,
				0
			);
			$question->setErrorMessage('Selected database is not valid');

			$dbName = $helper->ask($input, $output, $question);
			$output->writeln('Chosen database: ' . $dbName);
			
			//Add the dbname property
			$connectionParams['dbname'] = $dbName;
			
			$conn = $this->createConnection($connectionParams);
			
			$sm = $conn->getSchemaManager();
		
			$tables = $sm->listTables();
			
			$this->loadConfiguration();
			
			$progress = new ProgressBar($output, count($tables));
			$progress->start();
			
			foreach ($tables as $table) {
				//$output->writeln($table->getName() . " columns:\n\n");
					
				//Columns
				/*
				foreach ($table->getColumns() as $column) {
					//$output->writeln(' - ' . $column->getName() . ': ' . $column->getType() . "\n");
				}
				*/
					
				//Foreign keys
				$name = $table->getName();
				$table = $sm->listTableDetails($name);
				//$foreignKeys = $table->getForeignKeys();
				//$output->writeln("Foreign keys (" . count($foreignKeys) . ")");
				/*
				foreach ($foreignKeys as $foreignKey) {
					//$output->writeln("\n");
					$foreignColumns = $foreignKey->getForeignColumns();
					$localColumns = $foreignKey->getLocalColumns();
					foreach($foreignColumns as $key => $foreignColumn){
						//$output->writeln($foreignKey->getLocalTableName() . "." . $localColumns[$key] . " <=> " . $foreignKey->getForeignTableName() . "." . $foreignColumn . "\n");
					}
				}
				*/
		
				$primaryKeys = $table->getPrimaryKeyColumns();
				//$output->writeln("Primary keys (" . count($primaryKeys) . ")");
				/*
				foreach ($primaryKeys as $primaryKey) {
					//$output->writeln("\n" . $primaryKey);
				}
				*/
				
				//$output->writeln("\n\n");
				$this->generateCode($name, reset($primaryKeys));
				
				$progress->advance();
			}
			
			$progress->finish();
		} catch(\Exception $ex){
			$output->writeln('Generator has found the current exception: ');
			$output->writeln($ex->getMessage());
		}
    }