Skip to content

Commit c6d2bc4

Browse files
committed
cs
1 parent bc0d884 commit c6d2bc4

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

β€Žcomponents/console/helpers/tree.rst

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Building a Tree from an Array
1515
You can build a tree from an array by passing the array to the :method:`Symfony\\Component\\Console\\Helper\\TreeHelper::createTree`
1616
method::
1717

18-
use Symfony\\Component\\Console\\Helper\\TreeHelper;
18+
use Symfony\Component\Console\Helper\TreeHelper;
1919

2020
$tree = TreeHelper::createTree($io, null, [
2121
'src' => [
@@ -44,27 +44,25 @@ The above code will output the following tree:
4444
└── templates
4545
└── base.html.twig
4646
47-
4847
Manually Creating a Tree
4948
~~~~~~~~~~~~~~~~~~~~~~~~
5049

5150
You can manually create a tree by creating a new instance of the :class:`Symfony\\Component\\Console\\Helper\\Tree` class and adding nodes to it::
5251

53-
use Symfony\\Component\\Console\\Helper\\Tree;
54-
use Symfony\\Component\\Console\\Helper\\TreeHelper;
52+
use Symfony\Component\Console\Helper\Tree
53+
use Symfony\Component\Console\Helper\TreeHelper;
5554

56-
$tree = new Tree($io);
57-
$tree->add('src', [
55+
$node = TreeNode::fromValues([
5856
'Command',
5957
'Controller' => [
6058
'DefaultController.php',
6159
],
6260
'Kernel.php',
6361
]);
64-
$tree->add('templates', [
62+
$node->add('templates', [
6563
'base.html.twig',
6664
]);
67-
65+
$tree = TreeHelper::createTree($io, $node);
6866
$tree->render();
6967

7068
Customizing the Tree Style
@@ -200,8 +198,8 @@ Making a Custom Tree Style
200198
You can create your own tree style by passing the characters to the constructor
201199
of the :class:`Symfony\\Component\\Console\\Helper\\TreeStyle` class::
202200

203-
use Symfony\\Component\\Console\\Helper\\TreeHelper;
204-
use Symfony\\Component\\Console\\Helper\\TreeStyle;
201+
use Symfony\Component\Console\Helper\TreeHelper;
202+
use Symfony\Component\Console\Helper\TreeStyle;
205203

206204
$customStyle = new TreeStyle('🟣 ', '🟠 ', 'πŸ”΅ ', '🟒 ', 'πŸ”΄ ', '🟑 ');
207205

@@ -224,7 +222,7 @@ of the :class:`Symfony\\Component\\Console\\Helper\\TreeStyle` class::
224222

225223
The above code will output the following tree:
226224

227-
..code-block:: text
225+
.. code-block:: text
228226
229227
πŸ”΅ 🟣 🟑 src
230228
πŸ”΅ 🟒 🟣 🟑 Command

0 commit comments

Comments
Β (0)