CoreFiles by mySites.guru
TreeStyle.php78 lines, 2,314 bytes, from Joomla_6.0.0-beta1-Beta-Full_Package.zip
Raw History Compare with 5.4.0-beta3
md5
3e2749b5065e9385a4abbf04ef74428a
sha1
609b9929507aa5b53ac59c5a051a146b33500b2d
sha256
fe47a9a22ce4e1a3cac05c663b645adad2ecbd8068049a0726394340185d4107
<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Console\Helper;

/**
 * Configures the output of the Tree helper.
 *
 * @author Simon André <[email protected]>
 */
final class TreeStyle
{
    public function __construct(
        private readonly string $prefixEndHasNext,
        private readonly string $prefixEndLast,
        private readonly string $prefixLeft,
        private readonly string $prefixMidHasNext,
        private readonly string $prefixMidLast,
        private readonly string $prefixRight,
    ) {
    }

    public static function box(): self
    {
        return new self('┃╸ ', '┗╸ ', '', '┃  ', '   ', '');
    }

    public static function boxDouble(): self
    {
        return new self('╠═ ', '╚═ ', '', '║  ', '  ', '');
    }

    public static function compact(): self
    {
        return new self('├ ', '└ ', '', '│ ', '  ', '');
    }

    public static function default(): self
    {
        return new self('├── ', '└── ', '', '│   ', '   ', '');
    }

    public static function light(): self
    {
        return new self('|-- ', '`-- ', '', '|   ', '    ', '');
    }

    public static function minimal(): self
    {
        return new self('. ', '. ', '', '. ', '  ', '');
    }

    public static function rounded(): self
    {
        return new self('├─ ', '╰─ ', '', '│  ', '   ', '');
    }

    /**
     * @internal
     */
    public function applyPrefixes(\RecursiveTreeIterator $iterator): void
    {
        $iterator->setPrefixPart(\RecursiveTreeIterator::PREFIX_LEFT, $this->prefixLeft);
        $iterator->setPrefixPart(\RecursiveTreeIterator::PREFIX_MID_HAS_NEXT, $this->prefixMidHasNext);
        $iterator->setPrefixPart(\RecursiveTreeIterator::PREFIX_MID_LAST, $this->prefixMidLast);
        $iterator->setPrefixPart(\RecursiveTreeIterator::PREFIX_END_HAS_NEXT, $this->prefixEndHasNext);
        $iterator->setPrefixPart(\RecursiveTreeIterator::PREFIX_END_LAST, $this->prefixEndLast);
        $iterator->setPrefixPart(\RecursiveTreeIterator::PREFIX_RIGHT, $this->prefixRight);
    }
}

The same content is in 48 releases, Joomla 6.0.0-beta1 to 6.2.1. See them all, or every version of this file.