Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/old/vendor/friendsofphp/php-cs-fixer/src/Console/Report/FixReport/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/friendsofphp/php-cs-fixer/src/Console/Report/FixReport/ReporterFactory.php
<?php

declare(strict_types=1);

/*
 * This file is part of PHP CS Fixer.
 *
 * (c) Fabien Potencier <[email protected]>
 *     Dariusz RumiƄski <[email protected]>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace PhpCsFixer\Console\Report\FixReport;

use Symfony\Component\Finder\Finder as SymfonyFinder;

/**
 * @author Boris Gorbylev <[email protected]>
 *
 * @internal
 */
final class ReporterFactory
{
    /** @var array<string, ReporterInterface> */
    private array $reporters = [];

    public function registerBuiltInReporters(): self
    {
        /** @var null|list<string> $builtInReporters */
        static $builtInReporters;

        if (null === $builtInReporters) {
            $builtInReporters = [];

            foreach (SymfonyFinder::create()->files()->name('*Reporter.php')->in(__DIR__) as $file) {
                $relativeNamespace = $file->getRelativePath();
                $builtInReporters[] = sprintf(
                    '%s\\%s%s',
                    __NAMESPACE__,
                    '' !== $relativeNamespace ? $relativeNamespace.'\\' : '',
                    $file->getBasename('.php')
                );
            }
        }

        foreach ($builtInReporters as $reporterClass) {
            $this->registerReporter(new $reporterClass());
        }

        return $this;
    }

    /**
     * @return $this
     */
    public function registerReporter(ReporterInterface $reporter): self
    {
        $format = $reporter->getFormat();

        if (isset($this->reporters[$format])) {
            throw new \UnexpectedValueException(sprintf('Reporter for format "%s" is already registered.', $format));
        }

        $this->reporters[$format] = $reporter;

        return $this;
    }

    /**
     * @return list<string>
     */
    public function getFormats(): array
    {
        $formats = array_keys($this->reporters);
        sort($formats);

        return $formats;
    }

    public function getReporter(string $format): ReporterInterface
    {
        if (!isset($this->reporters[$format])) {
            throw new \UnexpectedValueException(sprintf('Reporter for format "%s" is not registered.', $format));
        }

        return $this->reporters[$format];
    }
}

Spamworldpro Mini