keboola/symfony-console-nested-formatter-helper

Nested array formatter helper for Symfony Console

0.1.2 2016-05-10 06:48 UTC

This package is auto-updated.

Last update: 2024-03-29 02:23:10 UTC


README

Build Status

Nested array formatter helper for Symfony Console.

Usage

  	$input = array(
			'first' => 'something',
			'second' => array(
				'item 1' => 'val 1',
				'item 2' => 'val 2',
				'item 3' => array(
					'sub item 1' => 'value 1',
					'sub item 2' => 'value 2',
				),
				'item 4' => array(
					'one',
					array(
						'nested',
						'more',
					),
					'three',
				)
			),
			'third' => 'haha',
		);
    
   $formatter = new NestedFormatterHelper();
   echo $formatter->format($input);

Output:

first: something
second:
  item 1: val 1
  item 2: val 2
  item 3:
    sub item 1: value 1
    sub item 2: value 2
  item 4:
    - one
    -
      - nested
      - more
    - three
third: haha