src/Composer/Command/ShowCommand.php
protected function displayPackageTree(array $arrayTree)
    {
        $io = $this->getIO();
        foreach ($arrayTree as $package) {
            $io->write(sprintf('<info>%s</info>', $package['name']), false);
            $io->write(' ' . $package['version'], false);
            $io->write(' ' . strtok($package['description'], "\r\n"));

            if (isset($package['requires'])) {
                $requires = $package['requires'];
                $treeBar = '├';
                $j = 0;
                $total = count($requires);
                foreach ($requires as $require) {
                    $requireName = $require['name'];
                    $j++;
                    if ($j === $total) {
                        $treeBar = '└';
                    }
                    $level = 1;
                    $color = $this->colors[$level];
                    $info = sprintf(
                        '%s──<%s>%s</%s> %s',
                        $treeBar,
                        $color,
                        $requireName,
                        $color,
                        $require['version']
                    );
                    $this->writeTreeLine($info);

                    $treeBar = str_replace('└', ' ', $treeBar);
                    $packagesInTree = array($package['name'], $requireName);

                    $this->displayTree($require, $packagesInTree, $treeBar, $level + 1);
                }
            }
        }
    }
protected function displayPackageTree(array $arrayTree)
    {
        $io = $this->getIO();
        foreach ($arrayTree as $package) {
            $io->write(sprintf('<info>%s</info>', $package['name']), false);
            $io->write(' ' . $package['version'], false);
            $io->write(' ' . strtok($package['description'], "\r\n"));

            if (isset($package['requires'])) {
                $requires = $package['requires'];
                $treeBar = '├';
                $j = 0;
                $total = count($requires);
                foreach ($requires as $require) {
                    $requireName = $require['name'];
                    $j++;
                    if ($j === $total) {
                        $treeBar = '└';
                    }
                    $level = 1;
                    $color = $this->colors[$level];
                    $info = sprintf(
                        '%s──<%s>%s</%s> %s',
                        $treeBar,
                        $color,
                        $requireName,
                        $color,
                        $require['version']
                    );
                    $this->writeTreeLine($info);

                    $treeBar = str_replace('└', ' ', $treeBar);
                    $packagesInTree = array($package['name'], $requireName);

                    $this->displayTree($require, $packagesInTree, $treeBar, $level + 1);
                }
            }
        }
    }
protected function displayPackageTree ( array $ arrayTree ) { $ io = $ this -> getIO ( ) ; foreach ( $ arrayTree as $ package ) { $ io -> write ( sprintf ( '<info>%s</info>' , $ package [ 'name' ] ) , false ) ; $ io -> write ( ' ' . $ package [ 'version' ] , false ) ; $ io -> write ( ' ' . strtok ( $ package [ 'description' ] , "\r\n" ) ) ; if ( isset ( $ package [ 'requires' ] ) ) { $ requires = $ package [ 'requires' ] ; $ treeBar = '├'; $ j = 0 ; $ total = count ( $ requires ) ; foreach ( $ requires as $ require ) { $ requireName = $ require [ 'name' ] ; $ j ++ ; if ( $ j === $ total ) { $ treeBar = '└'; } $ level = 1 ; $ color = $ this -> colors [ $ level ] ; $ info = sprintf ( '%s──<%s>%s</%s> %s', $ treeBar , $ color , $ requireName , $ color , $ require [ 'version' ] ) ; $ this -> writeTreeLine ( $ info ) ; $ treeBar = str_replace ( '└',  ' ',  $ r eeBar); $ packagesInTree = array ( $ package [ 'name' ] , $ requireName ) ; $ this -> displayTree ( $ require , $ packagesInTree , $ treeBar , $ level + 1 ) ; } } } }
Display the tree

@param array $arrayTree
Display the tree