text:
<?php

namespace Symfony\Component\Console;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Command\HelpCommand;
use Symfony\Component\Console\Command\ListCommand;
use Symfony\Component\Console\CommandLoader\CommandLoaderInterface;
use Symfony\Component\Console\Event\ConsoleCommandEvent;
use Symfony\Component\Console\Event\ConsoleErrorEvent;
use Symfony\Component\Console\Event\ConsoleTerminateEvent;
use Symfony\Component\Console\Exception\CommandNotFoundException;
use Symfony\Component\Console\Exception\ExceptionInterface;
use Symfony\Component\Console\Exception\LogicException;
use Symfony\Component\Console\Exception\NamespaceNotFoundException;
use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Helper\DebugFormatterHelper;
use Symfony\Component\Console\Helper\FormatterHelper;
use Symfony\Component\Console\Helper\Helper;
use Symfony\Component\Console\Helper\HelperSet;
use Symfony\Component\Console\Helper\ProcessHelper;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputAwareInterface;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Output\ConsoleOutputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\ErrorHandler\ErrorHandler;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Symfony\Contracts\Service\ResetInterface;

/**
 * An Application is the container for a collection of commands.
 *
 * It is the main entry point of a Console application.
 *
 * This class is optimized for a standard CLI environment.
 *
 * Usage:
 *
 *     $app = new Application('myapp', '1.0 (stable)');
 *     $app->add(new SimpleCommand());
 *     $app->run();
 *
 * @author Fabien Potencier <fabien@symfony.com>
 */
class Application implements ResetInterface
{
    private $commands = [];
    private $wantHelps = false;
    private $runningCommand;
    private $name;
    private $version;
    private $commandLoader;
    private $catchExceptions = true;
    private $autoExit = true;
    private $definition;
    private $helperSet;
    private $dispatcher;
    private $terminal;
    private $defaultCommand;
    private $singleCommand = false;
    private $initialized;

    public function __construct(string $name = 'UNKNOWN', string $version = 'UNKNOWN')
    {
        $this->name = $name;
        $this->version = $version;
        $this->terminal = new Terminal();
        $this->defaultCommand = 'list';
    }

    /**
     * @final
     */
    public function setDispatcher(EventDispatcherInterface $dispatcher)
    {
        $this->dispatcher = $dispatcher;
    }

    public function setCommandLoader(CommandLoaderInterface $commandLoader)
    {
        $this->commandLoader = $commandLoader;
    }

    /**
     * Runs the current application.
     *
     * @return int 0 if everything went fine, or an error code
     *
     * @throws \Exception When running fails. Bypass this when {@link setCatchExceptions()}.
     */
    public function run(InputInterface $input = null, OutputInterface $output = null)
    {
        putenv('LINES='.$this->terminal->getHeight());
        putenv('COLUMNS='.$this->terminal->getWidth());

        if (null === $input) {
            $input = new ArgvInput();
        }

        if (null === $output) {
            $output = new ConsoleOutput();
        }

        $renderException = function (\Throwable $e) use ($output) {
            if ($output instanceof ConsoleOutputInterface) {
                $this->renderThrowable($e, $output->getErrorOutput());
            } else {
                $this->renderThrowable($e, $output);
            }
        };
        if ($phpHandler = set_exception_handler($renderException)) {
            restore_exception_handler();
            if (!\is_array($phpHandler) || !$phpHandler[0] instanceof ErrorHandler) {
                $errorHandler = true;
            } elseif ($errorHandler = $phpHandler[0]->setExceptionHandler($renderException)) {
                $phpHandler[0]->setExceptionHandler($errorHandler);
            }
        }

        $this->configureIO($input, $output);

        try {
            $exitCode = $this->doRun($input, $output);
        } catch (\Exception $e) {
            if (!$this->catchExceptions) {
                throw $e;
            }

            $renderException($e);

            $exitCode = $e->getCode();
            if (is_numeric($exitCode)) {
                $exitCode = (int) $exitCode;
                if (0 === $exitCode) {
                    $exitCode = 1;
                }
            } else {
                $exitCode = 1;
            }
        } finally {
            // if the exception handler changed, keep it
            // otherwise, unregister $renderException
            if (!$phpHandler) {
                if (set_exception_handler($renderException) === $renderException) {
                    restore_exception_handler();
                }
                restore_exception_handler();
            } elseif (!$errorHandler) {
                $finalHandler = $phpHandler[0]->setExceptionHandler(null);
                if ($finalHandler !== $renderException) {
                    $phpHandler[0]->setExceptionHandler($finalHandler);
                }
            }
        }

        if ($this->autoExit) {
            if ($exitCode > 255) {
                $exitCode = 255;
            }

            exit($exitCode);
        }

        return $exitCode;
    }

    /**
     * Runs the current application.
     *
     * @return int 0 if everything went fine, or an error code
     */
    public function doRun(InputInterface $input, OutputInterface $output)
    {
        if (true === $input->hasParameterOption(['--version', '-V'], true)) {
            $output->writeln($this->getLongVersion());

            return 0;
        }

        try {
            // Makes ArgvInput::getFirstArgument() able to distinguish an option from an argument.
            $input->bind($this->getDefinition());
        } catch (ExceptionInterface $e) {
            // Errors must be ignored, full binding/validation happens later when the command is known.
        }

        $name = $this->getCommandName($input);
        if (true === $input->hasParameterOption(['--help', '-h'], true)) {
            if (!$name) {
                $name = 'help';
                $input = new ArrayInput(['command_name' => $this->defaultCommand]);
            } else {
                $this->wantHelps = true;
            }
        }

        if (!$name) {
            $name = $this->defaultCommand;
            $definition = $this->getDefinition();
            $definition->setArguments(array_merge(
                $definition->getArguments(),
                [
                    'command' => new InputArgument('command', InputArgument::OPTIONAL, $definition->getArgument('command')->getDescription(), $name),
                ]
            ));
        }

        try {
            $this->runningCommand = null;
            // the command name MUST be the first element of the input
            $command = $this->find($name);
        } catch (\Throwable $e) {
            if (!($e instanceof CommandNotFoundException && !$e instanceof NamespaceNotFoundException) || 1 !== \count($alternatives = $e->getAlternatives()) || !$input->isInteractive()) {
                if (null !== $this->dispatcher) {
                    $event = new ConsoleErrorEvent($input, $output, $e);
                    $this->dispatcher->dispatch($event, ConsoleEvents::ERROR);

                    if (0 === $event->getExitCode()) {
                        return 0;
                    }

                    $e = $event->getError();
                }

                throw $e;
            }

            $alternative = $alternatives[0];

            $style = new SymfonyStyle($input, $output);
            $style->block(sprintf("\nCommand \"%s\" is not defined.\n", $name), null, 'error');
            if (!$style->confirm(sprintf('Do you want to run "%s" instead? ', $alternative), false)) {
                if (null !== $this->dispatcher) {
                    $event = new ConsoleErrorEvent($input, $output, $e);
                    $this->dispatcher->dispatch($event, ConsoleEvents::ERROR);

                    return $event->getExitCode();
                }

                return 1;
            }

            $command = $this->find($alternative);
        }

        $this->runningCommand = $command;
        $exitCode = $this->doRunCommand($command, $input, $output);
        $this->runningCommand = null;

        return $exitCode;
    }

    /**
     * {@inheritdoc}
     */
    public function reset()
    {
    }

    public function setHelperSet(HelperSet $helperSet)
    {
        $this->helperSet = $helperSet;
    }

    /**
     * Get the helper set associated with the command.
     *
     * @return HelperSet The HelperSet instance associated with this command
     */
    public function getHelperSet()
    {
        if (!$this->helperSet) {
            $this->helperSet = $this->getDefaultHelperSet();
        }

        return $this->helperSet;
    }

    public function setDefinition(InputDefinition $definition)
    {
        $this->definition = $definition;
    }

    /**
     * Gets the InputDefinition related to this Application.
     *
     * @return InputDefinition The InputDefinition instance
     */
    public function getDefinition()
    {
        if (!$this->definition) {
            $this->definition = $this->getDefaultInputDefinition();
        }

        if ($this->singleCommand) {
            $inputDefinition = $this->definition;
            $inputDefinition->setArguments();

            return $inputDefinition;
        }

        return $this->definition;
    }

    /**
     * Gets the help message.
     *
     * @return string A help message
     */
    public function getHelp()
    {
        return $this->getLongVersion();
    }

    /**
     * Gets whether to catch exceptions or not during commands execution.
     *
     * @return bool Whether to catch exceptions or not during commands execution
     */
    public function areExceptionsCaught()
    {
        return $this->catchExceptions;
    }

    /**
     * Sets whether to catch exceptions or not during commands execution.
     */
    public function setCatchExceptions(bool $boolean)
    {
        $this->catchExceptions = $boolean;
    }

    /**
     * Gets whether to automatically exit after a command execution or not.
     *
     * @return bool Whether to automatically exit after a command execution or not
     */
    public function isAutoExitEnabled()
    {
        return $this->autoExit;
    }

    /**
     * Sets whether to automatically exit after a command execution or not.
     */
    public function setAutoExit(bool $boolean)
    {
        $this->autoExit = $boolean;
    }

    /**
     * Gets the name of the application.
     *
     * @return string The application name
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Sets the application name.
     **/
    public function setName(string $name)
    {
        $this->name = $name;
    }

    /**
     * Gets the application version.
     *
     * @return string The application version
     */
    public function getVersion()
    {
        return $this->version;
    }

    /**
     * Sets the application version.
     */
    public function setVersion(string $version)
    {
        $this->version = $version;
    }

    /**
     * Returns the long version of the application.
     *
     * @return string The long application version
     */
    public function getLongVersion()
    {
        if ('UNKNOWN' !== $this->getName()) {
            if ('UNKNOWN' !== $this->getVersion()) {
                return sprintf('%s <info>%s</info>', $this->getName(), $this->getVersion());
            }

            return $this->getName();
        }

        return 'Console Tool';
    }

    /**
     * Registers a new command.
     *
     * @return Command The newly created command
     */
    public function register(string $name)
    {
        return $this->add(new Command($name));
    }

    /**
     * Adds an array of command objects.
     *
     * If a Command is not enabled it will not be added.
     *
     * @param Command[] $commands An array of commands
     */
    public function addCommands(array $commands)
    {
        foreach ($commands as $command) {
            $this->add($command);
        }
    }

    /**
     * Adds a command object.
     *
     * If a command with the same name already exists, it will be overridden.
     * If the command is not enabled it will not be added.
     *
     * @return Command|null The registered command if enabled or null
     */
    public function add(Command $command)
    {
        $this->init();

        $command->setApplication($this);

        if (!$command->isEnabled()) {
            $command->setApplication(null);

            return null;
        }

        // Will throw if the command is not correctly initialized.
        $command->getDefinition();

        if (!$command->getName()) {
            throw new LogicException(sprintf('The command defined in "%s" cannot have an empty name.', get_debug_type($command)));
        }

        $this->commands[$command->getName()] = $command;

        foreach ($command->getAliases() as $alias) {
            $this->commands[$alias] = $command;
        }

        return $command;
    }

    /**
     * Returns a registered command by name or alias.
     *
     * @return Command A Command object
     *
     * @throws CommandNotFoundException When given command name does not exist
     */
    public function get(string $name)
    {
        $this->init();

        if (!$this->has($name)) {
            throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
        }

        $command = $this->commands[$name];

        if ($this->wantHelps) {
            $this->wantHelps = false;

            $helpCommand = $this->get('help');
            $helpCommand->setCommand($command);

            return $helpCommand;
        }

        return $command;
    }

    /**
     * Returns true if the command exists, false otherwise.
     *
     * @return bool true if the command exists, false otherwise
     */
    public function has(string $name)
    {
        $this->init();

        return isset($this->commands[$name]) || ($this->commandLoader && $this->commandLoader->has($name) && $this->add($this->commandLoader->get($name)));
    }

    /**
     * Returns an array of all unique namespaces used by currently registered commands.
     *
     * It does not return the global namespace which always exists.
     *
     * @return string[] An array of namespaces
     */
    public function getNamespaces()
    {
        $namespaces = [];
        foreach ($this->all() as $command) {
            if ($command->isHidden()) {
                continue;
            }

            $namespaces = array_merge($namespaces, $this->extractAllNamespaces($command->getName()));

            foreach ($command->getAliases() as $alias) {
                $namespaces = array_merge($namespaces, $this->extractAllNamespaces($alias));
            }
        }

        return array_values(array_unique(array_filter($namespaces)));
    }

    /**
     * Finds a registered namespace by a name or an abbreviation.
     *
     * @return string A registered namespace
     *
     * @throws NamespaceNotFoundException When namespace is incorrect or ambiguous
     */
    public function findNamespace(string $namespace)
    {
        $allNamespaces = $this->getNamespaces();
        $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $namespace);
        $namespaces = preg_grep('{^'.$expr.'}', $allNamespaces);

        if (empty($namespaces)) {
            $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace);

            if ($alternatives = $this->findAlternatives($namespace, $allNamespaces)) {
                if (1 == \count($alternatives)) {
                    $message .= "\n\nDid you mean this?\n    ";
                } else {
                    $message .= "\n\nDid you mean one of these?\n    ";
                }

                $message .= implode("\n    ", $alternatives);
            }

            throw new NamespaceNotFoundException($message, $alternatives);
        }

        $exact = \in_array($namespace, $namespaces, true);
        if (\count($namespaces) > 1 && !$exact) {
            throw new NamespaceNotFoundException(sprintf("The namespace \"%s\" is ambiguous.\nDid you mean one of these?\n%s.", $namespace, $this->getAbbreviationSuggestions(array_values($namespaces))), array_values($namespaces));
        }

        return $exact ? $namespace : reset($namespaces);
    }

    /**
     * Finds a command by name or alias.
     *
     * Contrary to get, this command tries to find the best
     * match if you give it an abbreviation of a name or alias.
     *
     * @return Command A Command instance
     *
     * @throws CommandNotFoundException When command name is incorrect or ambiguous
     */
    public function find(string $name)
    {
        $this->init();

        $aliases = [];

        foreach ($this->commands as $command) {
            foreach ($command->getAliases() as $alias) {
                if (!$this->has($alias)) {
                    $this->commands[$alias] = $command;
                }
            }
        }

        if ($this->has($name)) {
            return $this->get($name);
        }

        $allCommands = $this->commandLoader ? array_merge($this->commandLoader->getNames(), array_keys($this->commands)) : array_keys($this->commands);
        $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $name);
        $commands = preg_grep('{^'.$expr.'}', $allCommands);

        if (empty($commands)) {
            $commands = preg_grep('{^'.$expr.'}i', $allCommands);
        }

        // if no commands matched or we just matched namespaces
        if (empty($commands) || \count(preg_grep('{^'.$expr.'$}i', $commands)) < 1) {
            if (false !== $pos = strrpos($name, ':')) {
                // check if a namespace exists and contains commands
                $this->findNamespace(substr($name, 0, $pos));
            }

            $message = sprintf('Command "%s" is not defined.', $name);

            if ($alternatives = $this->findAlternatives($name, $allCommands)) {
                // remove hidden commands
                $alternatives = array_filter($alternatives, function ($name) {
                    return !$this->get($name)->isHidden();
                });

                if (1 == \count($alternatives)) {
                    $message .= "\n\nDid you mean this?\n    ";
                } else {
                    $message .= "\n\nDid you mean one of these?\n    ";
                }
                $message .= implode("\n    ", $alternatives);
            }

            throw new CommandNotFoundException($message, array_values($alternatives));
        }

        // filter out aliases for commands which are already on the list
        if (\count($commands) > 1) {
            $commandList = $this->commandLoader ? array_merge(array_flip($this->commandLoader->getNames()), $this->commands) : $this->commands;
            $commands = array_unique(array_filter($commands, function ($nameOrAlias) use (&$commandList, $commands, &$aliases) {
                if (!$commandList[$nameOrAlias] instanceof Command) {
                    $commandList[$nameOrAlias] = $this->commandLoader->get($nameOrAlias);
                }

                $commandName = $commandList[$nameOrAlias]->getName();

                $aliases[$nameOrAlias] = $commandName;

                return $commandName === $nameOrAlias || !\in_array($commandName, $commands);
            }));
        }

        if (\count($commands) > 1) {
            $usableWidth = $this->terminal->getWidth() - 10;
            $abbrevs = array_values($commands);
            $maxLen = 0;
            foreach ($abbrevs as $abbrev) {
                $maxLen = max(Helper::strlen($abbrev), $maxLen);
            }
            $abbrevs = array_map(function ($cmd) use ($commandList, $usableWidth, $maxLen, &$commands) {
                if ($commandList[$cmd]->isHidden()) {
                    unset($commands[array_search($cmd, $commands)]);

                    return false;
                }

                $abbrev = str_pad($cmd, $maxLen, ' ').' '.$commandList[$cmd]->getDescription();

                return Helper::strlen($abbrev) > $usableWidth ? Helper::substr($abbrev, 0, $usableWidth - 3).'...' : $abbrev;
            }, array_values($commands));

            if (\count($commands) > 1) {
                $suggestions = $this->getAbbreviationSuggestions(array_filter($abbrevs));

                throw new CommandNotFoundException(sprintf("Command \"%s\" is ambiguous.\nDid you mean one of these?\n%s.", $name, $suggestions), array_values($commands));
            }
        }

        $command = $this->get(reset($commands));

        if ($command->isHidden()) {
            throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
        }

        return $command;
    }

    /**
     * Gets the commands (registered in the given namespace if provided).
     *
     * The array keys are the full names and the values the command instances.
     *
     * @return Command[] An array of Command instances
     */
    public function all(string $namespace = null)
    {
        $this->init();

        if (null === $namespace) {
            if (!$this->commandLoader) {
                return $this->commands;
            }

            $commands = $this->commands;
            foreach ($this->commandLoader->getNames() as $name) {
                if (!isset($commands[$name]) && $this->has($name)) {
                    $commands[$name] = $this->get($name);
                }
            }

            return $commands;
        }

        $commands = [];
        foreach ($this->commands as $name => $command) {
            if ($namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1)) {
                $commands[$name] = $command;
            }
        }

        if ($this->commandLoader) {
            foreach ($this->commandLoader->getNames() as $name) {
                if (!isset($commands[$name]) && $namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1) && $this->has($name)) {
                    $commands[$name] = $this->get($name);
                }
            }
        }

        return $commands;
    }

    /**
     * Returns an array of possible abbreviations given a set of names.
     *
     * @return string[][] An array of abbreviations
     */
    public static function getAbbreviations(array $names)
    {
        $abbrevs = [];
        foreach ($names as $name) {
            for ($len = \strlen($name); $len > 0; --$len) {
                $abbrev = substr($name, 0, $len);
                $abbrevs[$abbrev][] = $name;
            }
        }

        return $abbrevs;
    }

    public function renderThrowable(\Throwable $e, OutputInterface $output): void
    {
        $output->writeln('', OutputInterface::VERBOSITY_QUIET);

        $this->doRenderThrowable($e, $output);

        if (null !== $this->runningCommand) {
            $output->writeln(sprintf('<info>%s</info>', sprintf($this->runningCommand->getSynopsis(), $this->getName())), OutputInterface::VERBOSITY_QUIET);
            $output->writeln('', OutputInterface::VERBOSITY_QUIET);
        }
    }

    protected function doRenderThrowable(\Throwable $e, OutputInterface $output): void
    {
        do {
            $message = trim($e->getMessage());
            if ('' === $message || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
                $class = get_debug_type($e);
                $title = sprintf('  [%s%s]  ', $class, 0 !== ($code = $e->getCode()) ? ' ('.$code.')' : '');
                $len = Helper::strlen($title);
            } else {
                $len = 0;
            }

            if (false !== strpos($message, "@anonymous\0")) {
                $message = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)[0-9a-fA-F]++/', function ($m) {
                    return class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0];
                }, $message);
            }

            $width = $this->terminal->getWidth() ? $this->terminal->getWidth() - 1 : PHP_INT_MAX;
            $lines = [];
            foreach ('' !== $message ? preg_split('/\r?\n/', $message) : [] as $line) {
                foreach ($this->splitStringByWidth($line, $width - 4) as $line) {
                    // pre-format lines to get the right string length
                    $lineLength = Helper::strlen($line) + 4;
                    $lines[] = [$line, $lineLength];

                    $len = max($lineLength, $len);
                }
            }

            $messages = [];
            if (!$e instanceof ExceptionInterface || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
                $messages[] = sprintf('<comment>%s</comment>', OutputFormatter::escape(sprintf('In %s line %s:', basename($e->getFile()) ?: 'n/a', $e->getLine() ?: 'n/a')));
            }
            $messages[] = $emptyLine = sprintf('<error>%s</error>', str_repeat(' ', $len));
            if ('' === $message || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
                $messages[] = sprintf('<error>%s%s</error>', $title, str_repeat(' ', max(0, $len - Helper::strlen($title))));
            }
            foreach ($lines as $line) {
                $messages[] = sprintf('<error>  %s  %s</error>', OutputFormatter::escape($line[0]), str_repeat(' ', $len - $line[1]));
            }
            $messages[] = $emptyLine;
            $messages[] = '';

            $output->writeln($messages, OutputInterface::VERBOSITY_QUIET);

            if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
                $output->writeln('<comment>Exception trace:</comment>', OutputInterface::VERBOSITY_QUIET);

                // exception related properties
                $trace = $e->getTrace();

                array_unshift($trace, [
                    'function' => '',
                    'file' => $e->getFile() ?: 'n/a',
                    'line' => $e->getLine() ?: 'n/a',
                    'args' => [],
                ]);

                for ($i = 0, $count = \count($trace); $i < $count; ++$i) {
                    $class = isset($trace[$i]['class']) ? $trace[$i]['class'] : '';
                    $type = isset($trace[$i]['type']) ? $trace[$i]['type'] : '';
                    $function = isset($trace[$i]['function']) ? $trace[$i]['function'] : '';
                    $file = isset($trace[$i]['file']) ? $trace[$i]['file'] : 'n/a';
                    $line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a';

                    $output->writeln(sprintf(' %s%s at <info>%s:%s</info>', $class, $function ? $type.$function.'()' : '', $file, $line), OutputInterface::VERBOSITY_QUIET);
                }

                $output->writeln('', OutputInterface::VERBOSITY_QUIET);
            }
        } while ($e = $e->getPrevious());
    }

    /**
     * Configures the input and output instances based on the user arguments and options.
     */
    protected function configureIO(InputInterface $input, OutputInterface $output)
    {
        if (true === $input->hasParameterOption(['--ansi'], true)) {
            $output->setDecorated(true);
        } elseif (true === $input->hasParameterOption(['--no-ansi'], true)) {
            $output->setDecorated(false);
        }

        if (true === $input->hasParameterOption(['--no-interaction', '-n'], true)) {
            $input->setInteractive(false);
        }

        switch ($shellVerbosity = (int) getenv('SHELL_VERBOSITY')) {
            case -1: $output->setVerbosity(OutputInterface::VERBOSITY_QUIET); break;
            case 1: $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE); break;
            case 2: $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE); break;
            case 3: $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG); break;
            default: $shellVerbosity = 0; break;
        }

        if (true === $input->hasParameterOption(['--quiet', '-q'], true)) {
            $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
            $shellVerbosity = -1;
        } else {
            if ($input->hasParameterOption('-vvv', true) || $input->hasParameterOption('--verbose=3', true) || 3 === $input->getParameterOption('--verbose', false, true)) {
                $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
                $shellVerbosity = 3;
            } elseif ($input->hasParameterOption('-vv', true) || $input->hasParameterOption('--verbose=2', true) || 2 === $input->getParameterOption('--verbose', false, true)) {
                $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
                $shellVerbosity = 2;
            } elseif ($input->hasParameterOption('-v', true) || $input->hasParameterOption('--verbose=1', true) || $input->hasParameterOption('--verbose', true) || $input->getParameterOption('--verbose', false, true)) {
                $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
                $shellVerbosity = 1;
            }
        }

        if (-1 === $shellVerbosity) {
            $input->setInteractive(false);
        }

        putenv('SHELL_VERBOSITY='.$shellVerbosity);
        $_ENV['SHELL_VERBOSITY'] = $shellVerbosity;
        $_SERVER['SHELL_VERBOSITY'] = $shellVerbosity;
    }

    /**
     * Runs the current command.
     *
     * If an event dispatcher has been attached to the application,
     * events are also dispatched during the life-cycle of the command.
     *
     * @return int 0 if everything went fine, or an error code
     */
    protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
    {
        foreach ($command->getHelperSet() as $helper) {
            if ($helper instanceof InputAwareInterface) {
                $helper->setInput($input);
            }
        }

        if (null === $this->dispatcher) {
            return $command->run($input, $output);
        }

        // bind before the console.command event, so the listeners have access to input options/arguments
        try {
            $command->mergeApplicationDefinition();
            $input->bind($command->getDefinition());
        } catch (ExceptionInterface $e) {
            // ignore invalid options/arguments for now, to allow the event listeners to customize the InputDefinition
        }

        $event = new ConsoleCommandEvent($command, $input, $output);
        $e = null;

        try {
            $this->dispatcher->dispatch($event, ConsoleEvents::COMMAND);

            if ($event->commandShouldRun()) {
                $exitCode = $command->run($input, $output);
            } else {
                $exitCode = ConsoleCommandEvent::RETURN_CODE_DISABLED;
            }
        } catch (\Throwable $e) {
            $event = new ConsoleErrorEvent($input, $output, $e, $command);
            $this->dispatcher->dispatch($event, ConsoleEvents::ERROR);
            $e = $event->getError();

            if (0 === $exitCode = $event->getExitCode()) {
                $e = null;
            }
        }

        $event = new ConsoleTerminateEvent($command, $input, $output, $exitCode);
        $this->dispatcher->dispatch($event, ConsoleEvents::TERMINATE);

        if (null !== $e) {
            throw $e;
        }

        return $event->getExitCode();
    }

    /**
     * Gets the name of the command based on input.
     *
     * @return string|null
     */
    protected function getCommandName(InputInterface $input)
    {
        return $this->singleCommand ? $this->defaultCommand : $input->getFirstArgument();
    }

    /**
     * Gets the default input definition.
     *
     * @return InputDefinition An InputDefinition instance
     */
    protected function getDefaultInputDefinition()
    {
        return new InputDefinition([
            new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'),

            new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message'),
            new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message'),
            new InputOption('--verbose', '-v|vv|vvv', InputOption::VALUE_NONE, 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug'),
            new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version'),
            new InputOption('--ansi', '', InputOption::VALUE_NONE, 'Force ANSI output'),
            new InputOption('--no-ansi', '', InputOption::VALUE_NONE, 'Disable ANSI output'),
            new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question'),
        ]);
    }

    /**
     * Gets the default commands that should always be available.
     *
     * @return Command[] An array of default Command instances
     */
    protected function getDefaultCommands()
    {
        return [new HelpCommand(), new ListCommand()];
    }

    /**
     * Gets the default helper set with the helpers that should always be available.
     *
     * @return HelperSet A HelperSet instance
     */
    protected function getDefaultHelperSet()
    {
        return new HelperSet([
            new FormatterHelper(),
            new DebugFormatterHelper(),
            new ProcessHelper(),
            new QuestionHelper(),
        ]);
    }

    /**
     * Returns abbreviated suggestions in string format.
     */
    private function getAbbreviationSuggestions(array $abbrevs): string
    {
        return '    '.implode("\n    ", $abbrevs);
    }

    /**
     * Returns the namespace part of the command name.
     *
     * This method is not part of public API and should not be used directly.
     *
     * @return string The namespace of the command
     */
    public function extractNamespace(string $name, int $limit = null)
    {
        $parts = explode(':', $name, -1);

        return implode(':', null === $limit ? $parts : \array_slice($parts, 0, $limit));
    }

    /**
     * Finds alternative of $name among $collection,
     * if nothing is found in $collection, try in $abbrevs.
     *
     * @return string[] A sorted array of similar string
     */
    private function findAlternatives(string $name, iterable $collection): array
    {
        $threshold = 1e3;
        $alternatives = [];

        $collectionParts = [];
        foreach ($collection as $item) {
            $collectionParts[$item] = explode(':', $item);
        }

        foreach (explode(':', $name) as $i => $subname) {
            foreach ($collectionParts as $collectionName => $parts) {
                $exists = isset($alternatives[$collectionName]);
                if (!isset($parts[$i]) && $exists) {
                    $alternatives[$collectionName] += $threshold;
                    continue;
                } elseif (!isset($parts[$i])) {
                    continue;
                }

                $lev = levenshtein($subname, $parts[$i]);
                if ($lev <= \strlen($subname) / 3 || '' !== $subname && false !== strpos($parts[$i], $subname)) {
                    $alternatives[$collectionName] = $exists ? $alternatives[$collectionName] + $lev : $lev;
                } elseif ($exists) {
                    $alternatives[$collectionName] += $threshold;
                }
            }
        }

        foreach ($collection as $item) {
            $lev = levenshtein($name, $item);
            if ($lev <= \strlen($name) / 3 || false !== strpos($item, $name)) {
                $alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev;
            }
        }

        $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; });
        ksort($alternatives, SORT_NATURAL | SORT_FLAG_CASE);

        return array_keys($alternatives);
    }

    /**
     * Sets the default Command name.
     *
     * @return self
     */
    public function setDefaultCommand(string $commandName, bool $isSingleCommand = false)
    {
        $this->defaultCommand = $commandName;

        if ($isSingleCommand) {
            // Ensure the command exist
            $this->find($commandName);

            $this->singleCommand = true;
        }

        return $this;
    }

    /**
     * @internal
     */
    public function isSingleCommand(): bool
    {
        return $this->singleCommand;
    }

    private function splitStringByWidth(string $string, int $width): array
    {
        // str_split is not suitable for multi-byte characters, we should use preg_split to get char array properly.
        // additionally, array_slice() is not enough as some character has doubled width.
        // we need a function to split string not by character count but by string width
        if (false === $encoding = mb_detect_encoding($string, null, true)) {
            return str_split($string, $width);
        }

        $utf8String = mb_convert_encoding($string, 'utf8', $encoding);
        $lines = [];
        $line = '';

        $offset = 0;
        while (preg_match('/.{1,10000}/u', $utf8String, $m, 0, $offset)) {
            $offset += \strlen($m[0]);

            foreach (preg_split('//u', $m[0]) as $char) {
                // test if $char could be appended to current line
                if (mb_strwidth($line.$char, 'utf8') <= $width) {
                    $line .= $char;
                    continue;
                }
                // if not, push current line to array and make new line
                $lines[] = str_pad($line, $width);
                $line = $char;
            }
        }

        $lines[] = \count($lines) ? str_pad($line, $width) : $line;

        mb_convert_variables($encoding, 'utf8', $lines);

        return $lines;
    }

    /**
     * Returns all namespaces of the command name.
     *
     * @return string[] The namespaces of the command
     */
    private function extractAllNamespaces(string $name): array
    {
        // -1 as third argument is needed to skip the command short name when exploding
        $parts = explode(':', $name, -1);
        $namespaces = [];

        foreach ($parts as $part) {
            if (\count($namespaces)) {
                $namespaces[] = end($namespaces).':'.$part;
            } else {
                $namespaces[] = $part;
            }
        }

        return $namespaces;
    }

    private function init()
    {
        if ($this->initialized) {
            return;
        }
        $this->initialized = true;

        foreach ($this->getDefaultCommands() as $command) {
            $this->add($command);
        }
    }
}


text:
using UnityEngine;
using System.Collections;

public class RotatingObjectBehaviour : MonoBehaviour {

	public float rotationSpeed;

	// Use this for initialization
	void Start ()
	{
		this.GetComponent<Rigidbody> ().angularVelocity = new Vector3 (0, rotationSpeed, 0);
	}

	// Update is called once per frame
	void Update ()
	{
	}
}

redpajama_set_name: RedPajamaGithub


text:
package com.facebook.buck.core.parser.buildtargetparser;

import static com.facebook.buck.core.cell.TestCellBuilder.createCellRoots;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import com.facebook.buck.core.cell.CellPathResolver;
import com.facebook.buck.core.cell.CellPathResolverView;
import com.facebook.buck.core.cell.impl.DefaultCellPathResolver;
import com.facebook.buck.core.exceptions.BuildTargetParseException;
import com.facebook.buck.io.filesystem.ProjectFilesystem;
import com.facebook.buck.io.filesystem.impl.FakeProjectFilesystem;
import com.facebook.buck.parser.exceptions.NoSuchBuildTargetException;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import java.nio.file.FileSystem;
import java.util.stream.Stream;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

public class BuildTargetPatternParserTest {

  private ProjectFilesystem filesystem;
  private FileSystem vfs;

  @Rule public ExpectedException exception = ExpectedException.none();

  @Before
  public void setUp() {
    filesystem = FakeProjectFilesystem.createJavaOnlyFilesystem();
    vfs = filesystem.getRootPath().getFileSystem();
  }

  @Test
  public void testParse() throws NoSuchBuildTargetException {
    BuildTargetPatternParser<BuildTargetPattern> buildTargetPatternParser =
        BuildTargetPatternParser.forVisibilityArgument();

    assertEquals(
        ImmediateDirectoryBuildTargetPattern.of(
            filesystem.getRootPath(), vfs.getPath("test/com/facebook/buck/parser/")),
        buildTargetPatternParser.parse(
            createCellRoots(filesystem), "//test/com/facebook/buck/parser:"));

    assertEquals(
        SingletonBuildTargetPattern.of(
            filesystem.getRootPath(), "//test/com/facebook/buck/parser:parser"),
        buildTargetPatternParser.parse(
            createCellRoots(filesystem), "//test/com/facebook/buck/parser:parser"));

    assertEquals(
        SubdirectoryBuildTargetPattern.of(
            filesystem.getRootPath(), vfs.getPath("test/com/facebook/buck/parser/")),
        buildTargetPatternParser.parse(
            createCellRoots(filesystem), "//test/com/facebook/buck/parser/..."));
  }

  @Test(expected = BuildTargetParseException.class)
  public void testParseWildcardWithInvalidContext() throws NoSuchBuildTargetException {
    BuildTargetPatternParser<BuildTargetPattern> buildTargetPatternParser =
        BuildTargetPatternParser.fullyQualified();

    buildTargetPatternParser.parse(createCellRoots(filesystem), "//...");
  }

  @Test
  public void testParseRootPattern() throws NoSuchBuildTargetException {
    BuildTargetPatternParser<BuildTargetPattern> buildTargetPatternParser =
        BuildTargetPatternParser.forVisibilityArgument();

    assertEquals(
        ImmediateDirectoryBuildTargetPattern.of(filesystem.getRootPath(), vfs.getPath("")),
        buildTargetPatternParser.parse(createCellRoots(filesystem), "//:"));

    assertEquals(
        SingletonBuildTargetPattern.of(filesystem.getRootPath(), "//:parser"),
        buildTargetPatternParser.parse(createCellRoots(filesystem), "//:parser"));

    assertEquals(
        SubdirectoryBuildTargetPattern.of(filesystem.getRootPath(), vfs.getPath("")),
        buildTargetPatternParser.parse(createCellRoots(filesystem), "//..."));
  }

  @Test
  public void visibilityCanContainCrossCellReference() {
    BuildTargetPatternParser<BuildTargetPattern> buildTargetPatternParser =
        BuildTargetPatternParser.forVisibilityArgument();

    ProjectFilesystem filesystem = FakeProjectFilesystem.createJavaOnlyFilesystem();
    CellPathResolver cellNames =
        DefaultCellPathResolver.of(
            filesystem.getPath("foo/root"),
            ImmutableMap.of("other", filesystem.getPath("foo/other")));

    assertEquals(
        SingletonBuildTargetPattern.of(filesystem.getPath("foo/other"), "//:something"),
        buildTargetPatternParser.parse(cellNames, "other//:something"));
    assertEquals(
        SubdirectoryBuildTargetPattern.of(
            filesystem.getPath("foo/other"), filesystem.getPath("sub")),
        buildTargetPatternParser.parse(cellNames, "other//sub/..."));
  }

  @Test
  public void visibilityCanMatchCrossCellTargets() {
    BuildTargetPatternParser<BuildTargetPattern> buildTargetPatternParser =
        BuildTargetPatternParser.forVisibilityArgument();

    ProjectFilesystem filesystem = FakeProjectFilesystem.createJavaOnlyFilesystem();
    CellPathResolver rootCellPathResolver =
        DefaultCellPathResolver.of(
            filesystem.getPath("root").normalize(),
            ImmutableMap.of(
                "other", filesystem.getPath("other").normalize(),
                "root", filesystem.getPath("root").normalize()));
    CellPathResolver otherCellPathResolver =
        new CellPathResolverView(
            rootCellPathResolver, ImmutableSet.of("root"), filesystem.getPath("other").normalize());

    // Root cell visibility from non-root cell
    Stream.of("other//lib:lib", "other//lib:", "other//lib/...")
        .forEach(
            patternString -> {
              BuildTargetPattern pattern =
                  buildTargetPatternParser.parse(rootCellPathResolver, patternString);
              assertTrue(
                  "from root matching something in non-root: " + pattern,
                  pattern.matches(
                      BuildTargetParser.INSTANCE.parse(
                          "//lib:lib",
                          BuildTargetPatternParser.fullyQualified(),
                          otherCellPathResolver)));
              assertFalse(
                  "from root failing to match something in root: " + pattern,
                  pattern.matches(
                      BuildTargetParser.INSTANCE.parse(
                          "//lib:lib",
                          BuildTargetPatternParser.fullyQualified(),
                          rootCellPathResolver)));
            });

    // Non-root cell visibility from root cell.
    Stream.of("root//lib:lib", "root//lib:", "root//lib/...")
        .forEach(
            patternString -> {
              BuildTargetPattern pattern =
                  buildTargetPatternParser.parse(otherCellPathResolver, patternString);
              assertTrue(
                  "from non-root matching something in root: " + pattern,
                  pattern.matches(
                      BuildTargetParser.INSTANCE.parse(
                          "//lib:lib",
                          BuildTargetPatternParser.fullyQualified(),
                          rootCellPathResolver)));
              assertFalse(
                  "from non-root matching something in non-root: " + pattern,
                  pattern.matches(
                      BuildTargetParser.INSTANCE.parse(
                          "//lib:lib",
                          BuildTargetPatternParser.fullyQualified(),
                          otherCellPathResolver)));
            });
  }

  @Test
  public void testParseAbsolutePath() {
    // Exception should be thrown by BuildTargetParser.checkBaseName()
    BuildTargetPatternParser<BuildTargetPattern> buildTargetPatternParser =
        BuildTargetPatternParser.forVisibilityArgument();

    exception.expect(BuildTargetParseException.class);
    exception.expectMessage("absolute");
    exception.expectMessage("(found ///facebookorca/...)");
    buildTargetPatternParser.parse(createCellRoots(filesystem), "///facebookorca/...");
  }

  @Test
  public void testIncludesTargetNameInMissingCellErrorMessage() {
    BuildTargetPatternParser<BuildTargetPattern> buildTargetPatternParser =
        BuildTargetPatternParser.forVisibilityArgument();

    ProjectFilesystem filesystem = FakeProjectFilesystem.createJavaOnlyFilesystem();
    CellPathResolver rootCellPathResolver =
        DefaultCellPathResolver.of(
            filesystem.getPath("root").normalize(),
            ImmutableMap.of("localreponame", filesystem.getPath("localrepo").normalize()));

    exception.expect(BuildTargetParseException.class);
    // It contains the pattern
    exception.expectMessage("lclreponame//facebook/...");
    // The invalid cell
    exception.expectMessage("Unknown cell: lclreponame");
    // And the suggestion
    exception.expectMessage("localreponame");
    buildTargetPatternParser.parse(rootCellPathResolver, "lclreponame//facebook/...");
  }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>shoken</artifactId>
        <groupId>com.bsuir.tofi</groupId>
        <version>1.0</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>payment-management-api-rest-adapter</artifactId>

    <dependencies>
        <dependency>
            <groupId>com.bsuir.tofi</groupId>
            <artifactId>payment-management-api</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-jsr310</artifactId>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
    </dependencies>
</project>


text:
@implementation XZPlayProgressView

- (instancetype)init{
    self = [super init];
    if (self) {
        [self resetAllSubviews];
    }
    return self;
}

- (void)layoutSubviews{
    [super layoutSubviews];
    if (_playBtn && _currentTimeLabel) {
        CGFloat btnWidth = self.bounds.size.height - 10.0;
        NSString *timeString = @"00:00:00";

        CGFloat timeWidth = ceilf([timeString boundingRectWithSize:CGSizeMake(100, 100) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:_currentTimeLabel.font} context:nil].size.width);
        _playBtn.frame = CGRectMake(10.0, 5.0, btnWidth, btnWidth);
        _currentTimeLabel.frame = CGRectMake(_playBtn.frame.origin.x + _playBtn.bounds.size.width + 5.0, 0, timeWidth, self.bounds.size.height);
        _fullBtn.frame = CGRectMake(self.bounds.size.width - _playBtn.bounds.size.width - _playBtn.frame.origin.x, _playBtn.frame.origin.y, _playBtn.bounds.size.width, _playBtn.bounds.size.height);
        _totalDurationLabel.frame = CGRectMake(_fullBtn.frame.origin.x - 5.0 - timeWidth, _currentTimeLabel.frame.origin.y, _currentTimeLabel.bounds.size.width, _currentTimeLabel.bounds.size.height);

        _timeIntervalProgress.bounds = CGRectMake(0, 0, self.bounds.size.width - 2 * (_currentTimeLabel.frame.origin.x + _currentTimeLabel.bounds.size.width + 5.0), 20.0);
        _timeIntervalProgress.center = CGPointMake(self.bounds.size.width / 2.0, self.bounds.size.height / 2.0);
        _progressSlider.bounds = CGRectMake(0, 0, self.bounds.size.width - 2 * (_currentTimeLabel.frame.origin.x + _currentTimeLabel.bounds.size.width + 5.0) + 3.4, 20.0);
        _progressSlider.center = CGPointMake(self.bounds.size.width / 2.0, self.bounds.size.height / 2.0);
//        _timeIntervalProgress.frame = CGRectMake(_currentTimeLabel.frame.origin.x + _currentTimeLabel.bounds.size.width + 5.0, self.bounds.size.height / 2.0 - 10.0, self.bounds.size.width - 2 * (_currentTimeLabel.frame.origin.x + _currentTimeLabel.bounds.size.width + 5.0), 20.0);
//        _progressSlider.frame = _timeIntervalProgress.frame;

    }
}

- (void)resetAllSubviews{

    for (UIView *subView in self.subviews) {
        [subView removeFromSuperview];
    }
    _playBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    _playBtn.backgroundColor = [UIColor clearColor];
    [self addSubview:_playBtn];
    [_playBtn setImage:[UIImage imageNamed:@"icon_pause"] forState:UIControlStateNormal];

    _currentTimeLabel = [[UILabel alloc]init];
    _currentTimeLabel.backgroundColor = [UIColor clearColor];
    _currentTimeLabel.font = [UIFont systemFontOfSize:13.0];
    _currentTimeLabel.textAlignment = NSTextAlignmentRight;
    _currentTimeLabel.textColor = [UIColor whiteColor];
    [self addSubview:_currentTimeLabel];

    _timeIntervalProgress = [[UIProgressView alloc]init];
    _timeIntervalProgress.backgroundColor = [UIColor clearColor];
    _timeIntervalProgress.trackTintColor = [UIColor grayColor];
    _timeIntervalProgress.tintColor = [UIColor lightGrayColor];
    [self addSubview:_timeIntervalProgress];

    _progressSlider = [[UISlider alloc]init];
    _progressSlider.backgroundColor = [UIColor clearColor];
    [_progressSlider setThumbImage:[UIImage imageNamed:@"icon_progress"] forState:UIControlStateNormal];
    [_progressSlider setThumbImage:[UIImage imageNamed:@"icon_progress"] forState:UIControlStateHighlighted];
    _progressSlider.maximumTrackTintColor = [UIColor clearColor];
    [self addSubview:_progressSlider];

    _totalDurationLabel = [[UILabel alloc]init];
    _totalDurationLabel.backgroundColor = [UIColor clearColor];
    _totalDurationLabel.font = [UIFont systemFontOfSize:13.0];
    _totalDurationLabel.textAlignment = NSTextAlignmentLeft;
    _totalDurationLabel.textColor = [UIColor whiteColor];
    [self addSubview:_totalDurationLabel];

    _fullBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    _fullBtn.backgroundColor = [UIColor clearColor];
    [_fullBtn setImage:[UIImage imageNamed:@"icon_full"] forState:UIControlStateNormal];
    [self addSubview:_fullBtn];

}

@end


text:
using System;
using System.Windows.Controls;
using WinCommandPalette.Plugin.CommandBase;
using WinCommandPalette.Plugin.CreateCommand;

namespace BaseCommandsPlugin.OpenFile
{
    public partial class CreateOpenFileCommand : UserControl, ICreateCommand
    {
        public string CommandTypeName => "Open Process";

        public string CommandDescription => "Open applications, websites or folders with this command.";

        private CreateOpenFileCommandModel viewModel;

        public CreateOpenFileCommand()
        {
            this.InitializeComponent();
            this.viewModel = new CreateOpenFileCommandModel();
            this.DataContext = this.viewModel;
        }

        public ICommandBase GetCommand()
        {
            return this.viewModel.GetCommand();
        }

        public void ShowCommand(ICommandBase command)
        {
            if (command is OpenFileCommand ofcommand)
            {
                this.viewModel.ShowCommand(ofcommand);
            }
        }

        public void ClearAll()
        {
            this.viewModel.ClearAll();
        }
    }
}


text:
ACCEPTED

#### According to
International Plant Names Index

#### Published in
null

#### Original name
Pellionia chikushiensis Yamam.

### Remarks
null


text:
layout: post
title: Tým
---

Jsme celkem tři, dvě holky a jeden kluk, a všichni jsme studenti KISKu (Katedra informačních studií a knihovnictví) Masarykovy univerzity v Brně.

### Členové týmu

#### Bára

#### Pája

#### Marek

### Motivace našeho týmu

Asi největší motivací je zpracování semestrálního projektu a tím pádem i jedné podmínky pro úspěšné ukončení povinného předmětu. Když už tedy musíme něco dělat, tak jsme se rozhodli zpracovat téma, které má podle nás smysl a mohlo by být pro někoho přínosem. Ať už totiž chceme nebo ne, tak se na pracák jednou "podívá" skoro každý. A jak se říká, štěstí přeje připraveným, takže chceme případným uchazečům o zaměstnání pomoci co nejlépe a nejsnadněji nalézt informace o tom, jak se můžou evidovat.


text:
var request = require('request');

module.exports = {
    ajaxRequest: function(url, callback) {
        var opts = { url: url, method: "GET" };

        request(opts, function(error, response, body) {
            return callback(body);
        });
    },

    jsonpRequest: function(url, callback) {
      var opts = {
          url: url,
          method: "GET"
      };

      request(opts, function(error, response, body) {
        try {
          response = JSON.parse(body);
          callback(response);
        } catch (e) {
          callback(error);
        }
      });
    },

    postRequest: function(url, data, callback) {
        console.log(data);
        var opts = { url: url, form: data, method: "POST", dataType: "text" };

        request(opts, function(error, response, body) {

            return callback(body);
        });
    },

    inArray: function(needle, haystack) {
        return haystack.indexOf(needle);
    }
};


text:
package org.sagebionetworks.repo.manager.oauth.claimprovider;

import org.sagebionetworks.repo.model.oauth.OIDCClaimName;
import org.sagebionetworks.repo.model.oauth.OIDCClaimsRequestDetails;
import org.sagebionetworks.repo.model.principal.PrincipalAliasDAO;
import org.springframework.beans.factory.annotation.Autowired;

public class UserNameClaimProvider implements OIDCClaimProvider {
	@Autowired
	private PrincipalAliasDAO principalAliasDao;

	@Override
	public OIDCClaimName getName() {
		return OIDCClaimName.user_name;
	}

	@Override
	public String getDescription() {
		return "To see your Synapse username";
	}

	@Override
	public Object getClaim(String userId, OIDCClaimsRequestDetails details) {
		return principalAliasDao.getUserName(Long.valueOf(userId));
	}

}


text:
<?php

namespace App\Exceptions;

use Exception;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Illuminate\Validation\ValidationException;
use Symfony\Component\HttpKernel\Exception\HttpException;

class Handler extends ExceptionHandler
{
    /**
     * A list of the exception types that should not be reported.
     *
     * @var array
     */
    protected $dontReport = [
        AuthorizationException::class,
        HttpException::class,
        ModelNotFoundException::class,
        ValidationException::class,
    ];

    /**
     * Report or log an exception.
     *
     * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
     *
     * @param \Exception $e
     *
     * @return void
     */
    public function report(Exception $e)
    {
        parent::report($e);
    }

    /**
     * Render an exception into an HTTP response.
     *
     * @param \Illuminate\Http\Request $request
     * @param \Exception               $e
     *
     * @return \Illuminate\Http\Response
     */
    public function render($request, Exception $e)
    {
        if ($e instanceof HttpResponseException) {
            return $e->getResponse();
        } elseif ($e instanceof ModelNotFoundException) {
            $e = new NotFoundHttpException($e->getMessage(), $e);
        } elseif ($e instanceof AuthenticationException) {
            return $this->unauthenticated($request, $e);
        } elseif ($e instanceof AuthorizationException) {
            $e = new HttpException(403, $e->getMessage());
        } elseif ($e instanceof ValidationException && $e->getResponse()) {
            return $e->getResponse();
        }

        if ($this->isHttpException($e)) {
            return $this->toIlluminateResponse($this->renderHttpException($e), $e);
        } else {
            // return $this->toIlluminateResponse($this->convertExceptionToResponse($e), $e);
            return \Response::view('errors.500', [], 500);
        }
    }
}


text:
/*
 |--------------------------------------------------------------------------
 | Map Router
 |--------------------------------------------------------------------------
 |
 | Allows to control de URL routes and triggers specific functions
 | in the map interface
 |
 |
 */
( function( $, window, document, app ){

    var MapRouter = Backbone.Router.extend({

            /**
            * Define the user routes
            *
            */
            routes: {
                "map": "renderMap",
                "map/pollution": "renderMapPollution",
                "map/symptoms": "renderMapSymptoms",
                "map/heatmap": "renderHeatmapPollution",
                "map/aerosol": "renderMapAerosol",
                "map/co2": "renderCOMap"
            }

        ,   initialize: function(){
            }

        ,   before: function(){

                if( ! localStorage.getItem('_id')){
                    app.routers.user.navigate('user/register', {trigger: true});
                    return false;
                }

                sublayers.removeClass('active');
            }

        ,   renderMap: function(){

                app.views.layout.hideMenu();
                app.views.layout.hideReportMenu();

                app.views.map.setCanvas( function(){

                    app.views.map.symptoms.once( 'sync', app.views.map.render );

                    app.views.map.pollutions.once( 'sync', function(){
                        app.views.map.symptoms.fetch({
                            // error: function(){ //alert( 'error!' );
                            // }
                        });
                    });

                    app.views.map.pollutions.fetch({
                        // error: function(){
                        //     //alert( 'error!' );
                        // }
                    });

                });

                // Call notifications
                app.views.notification.get();
            }

        ,   renderMapPollution: function(){

                console.log('here');

                // Pollutions collection
                //app.views.map.pollutions.once( 'sync', app.views.map.renderPollutionMap);

                app.views.layout.hideMenu();
                app.views.layout.hideReportMenu();

                app.views.map.pollutions.fetch({
                    //error: function(){ alert( 'error!' );}
                });
            }

        ,   renderMapSymptoms: function(){

                // Symptoms collection
                //app.views.map.symptoms.once( 'sync', app.views.map.renderSymptomsMap);

                app.views.layout.hideMenu();
                app.views.layout.hideReportMenu();
                sublayers.removeClass('active');

                app.views.map.symptoms.fetch({
                    //error: function(){ alert( 'error!' ); }
                });
            }

        ,   renderHeatmapPollution: function(){

                // Pollutions collection
                app.views.heatmap.pollutions.once( 'sync', app.views.heatmap.renderPollutionHeatmap);

                app.views.layout.hideMenu();
                app.views.layout.hideReportMenu();

                app.views.heatmap.pollutions.fetch({
                    //error: function(){ alert( 'error!' ); }
                });
            }

        ,   renderMapAerosol: function(){

                app.views.map.setCanvas( function(){

                    app.views.map.canvas = $('#map-canvas')[0];

                    // Init map canvas
                    app.views.map.map = new google.maps.Map( app.views.map.canvas, {
                        zoom: 3,
                        center: { lat: 28.895074, lng: 91.459554}
                    });

                    // Pollutions collection
                    app.views.map.setLayer('MODIS_Terra_Aerosol');
                });

            }

        ,   renderCOMap: function(){

                app.views.map.setCanvas( function(){

                    app.views.map.canvas = $('#map-canvas')[0];

                    // Init map canvas
                    app.views.map.map = new google.maps.Map( app.views.map.canvas, {
                        zoom: 3,
                        center: { lat: 28.895074, lng: 91.459554}
                    });

                    // Pollutions collection
                    app.views.map.setLayer('MLS_CO_215hPa_Day');
                });

            }

    });

    app.routers.map = new MapRouter();

    Backbone.history.start({
        root: '/',
        pushState: false,
        silent: false
    });

})( jQuery, this, this.document, window.Aircheck.app, undefined );


text:
<?php
namespace Burrow\Tactician;

use Burrow\QueuePublisher;
use League\Tactician\Middleware;
use League\Tactician\Plugins\NamedCommand\NamedCommand;

class QueuePublishingMiddleware implements Middleware
{
    /** @var CommandSerializer */
    private $serializer;

    /** @var QueuePublisher */
    private $queuePublisher;

    /**
     * Constructor
     *
     * @param CommandSerializer $serializer
     * @param QueuePublisher    $queuePublisher
     */
    public function __construct(CommandSerializer $serializer, QueuePublisher $queuePublisher)
    {
        $this->serializer = $serializer;
        $this->queuePublisher = $queuePublisher;
    }

    /**
     * @param object $command
     * @param callable $next
     *
     * @return mixed
     */
    public function execute($command, callable $next)
    {
        if (! $command instanceof NamedCommand) {
            throw new \InvalidArgumentException('Command must be a NamedCommand');
        }

        $this->queuePublisher->publish($this->serializer->serialize($command), $command->getCommandName());
    }
}


text:
package me.wangkang.springboot.course.Chapter2_1_1.service;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class BlogProperties {

	@Value("${me.wangkang.name}")
	private String name;
	@Value("${me.wangkang.title}")
	private String title;
	@Value("${me.wangkang.desc}")
	private String desc;

	@Value("${me.wangkang.value}")
	private String value;
	@Value("${me.wangkang.number}")
	private Integer number;
	@Value("${me.wangkang.bignumber}")
	private Long bignumber;
	@Value("${me.wangkang.test1}")
	private Integer test1;
	@Value("${me.wangkang.test2}")
	private Integer test2;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getDesc() {
		return desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public Integer getNumber() {
		return number;
	}

	public void setNumber(Integer number) {
		this.number = number;
	}

	public Long getBignumber() {
		return bignumber;
	}

	public void setBignumber(Long bignumber) {
		this.bignumber = bignumber;
	}

	public Integer getTest1() {
		return test1;
	}

	public void setTest1(Integer test1) {
		this.test1 = test1;
	}

	public Integer getTest2() {
		return test2;
	}

	public void setTest2(Integer test2) {
		this.test2 = test2;
	}
}


text:
import { SET_SESSION, SET_COOKIE } from "./session-reducer.js";

import type { sessionT } from "../api-types.js";

export const setCookie = (cookie: string) => ({
  type: SET_COOKIE,
  payload: {
    cookie
  }
});

export const setSession = (session: sessionT) => ({
  type: SET_SESSION,
  payload: {
    session
  }
});


text:
<?php

namespace frontend\models;

/**
 * This is the ActiveQuery class for [[House]].
 *
 * @see House
 */
class HouseQuery extends \yii\db\ActiveQuery
{
    /*public function active()
    {
        return $this->andWhere('[[status]]=1');
    }*/

    /**
     * @inheritdoc
     * @return House[]|array
     */
    public function all($db = null)
    {
        return parent::all($db);
    }

    /**
     * @inheritdoc
     * @return House|array|null
     */
    public function one($db = null)
    {
        return parent::one($db);
    }
}


text:
package com.zfgc.dbobj;

public class NavTabViewDbObj {

	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column NAV_TAB_VIEW.NAV_TAB_ID
	 * @mbg.generated  Sat Aug 17 15:37:50 EDT 2019
	 */
	private Integer navTabId;
	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column NAV_TAB_VIEW.TITLE
	 * @mbg.generated  Sat Aug 17 15:37:50 EDT 2019
	 */
	private String title;
	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column NAV_TAB_VIEW.SEQUENCE_NO
	 * @mbg.generated  Sat Aug 17 15:37:50 EDT 2019
	 */
	private Integer sequenceNo;
	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column NAV_TAB_VIEW.FA_ICON
	 * @mbg.generated  Sat Aug 17 15:37:50 EDT 2019
	 */
	private String faIcon;
	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column NAV_TAB_VIEW.CHILD_NAV_TAB_ID
	 * @mbg.generated  Sat Aug 17 15:37:50 EDT 2019
	 */
	private Integer childNavTabId;
	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column NAV_TAB_VIEW.PARENT_TAB_ID
	 * @mbg.generated  Sat Aug 17 15:37:50 EDT 2019
	 */
	private Integer parentTabId;
	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column NAV_TAB_VIEW.CHILD_TITLE
	 * @mbg.generated  Sat Aug 17 15:37:50 EDT 2019
	 */
	private String childTitle;
	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column NAV_TAB_VIEW.CHILD_SEQUENCE_NO
	 * @mbg.generated  Sat Aug 17 15:37:50 EDT 2019
	 */
	private Integer childSequenceNo;
	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column NAV_TAB_VIEW.LKUP_NAV_SECTION_ID
	 * @mbg.generated  Sat Aug 17 15:37:50 EDT 2019
	 */
	private Integer lkupNavSectionId;
	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column NAV_TAB_VIEW.ALLOW_SELF_FLAG
	 * @mbg.generated  Sat Aug 17 15:37:50 EDT 2019
	 */
	private Boolean allowSelfFlag;

	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column NAV_TAB_VIEW.NAV_TAB_ID
	 * @return  the value of NAV_TAB_VIEW.NAV_TAB_ID
	 * @mbg.generated  Sat Aug 17 15:37:50 EDT 2019
	 */
	public Integer getNavTabId() {
		return navTabId;
	}

	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column NAV_TAB_VIEW.NAV_TAB_ID
	 * @param navTabId  the value for NAV_TAB_VIEW.NAV_TAB_ID
	 * @mbg.generated  Sat Aug 17 15:37:50 EDT 2019
	 */
	public void setNavTabId(Integer navTabId) {
		this.navTabId = navTabId;
	}

	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column NAV_TAB_VIEW.TITLE
	 * @return  the value of NAV_TAB_VIEW.TITLE
	 * @mbg.generated  Sat Aug 17 15:37:50 EDT 2019
	 */
	public String getTitle() {
		return title;
	}

	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column NAV_TAB_VIEW.TITLE
	 * @param title  the value for NAV_TAB_VIEW.TITLE
	 * @mbg.generated  Sat Aug 17 15:37:50 EDT 2019
	 */
	public void setTitle(String title) {
		this.title = title;
	}

	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column NAV_TAB_VIEW.SEQUENCE_NO
	 * @return  the value of NAV_TAB_VIEW.SEQUENCE_NO
	 * @mbg.generated  Sat Aug 17 15:37:50 EDT 2019
	 */
	public Integer getSequenceNo() {
		return sequenceNo;
	}

	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column NAV_TAB_VIEW.SEQUENCE_NO
	 * @param sequenceNo  the value for NAV_TAB_VIEW.SEQUENCE_NO
	 * @mbg.generated  Sat Aug 17 15:37:50 EDT 2019
	 */
	public void setSequenceNo(Integer sequenceNo) {
		this.sequenceNo = sequenceNo;
	}

	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column NAV_TAB_VIEW.FA_ICON
	 * @return  the value of NAV_TAB_VIEW.FA_ICON
	 * @mbg.generated  Sat Aug 17 15:37:50 EDT 2019
	 */
	public String getFaIcon() {
		return faIcon;
	}

	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column NAV_TAB_VIEW.FA_ICON
	 * @param faIcon  the value for NAV_TAB_VIEW.FA_ICON
	 * @mbg.generated  Sat Aug 17 15:37:50 EDT 2019
	 */
	public void setFaIcon(String faIcon) {
		this.faIcon = faIcon;
	}

	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column NAV_TAB_VIEW.CHILD_NAV_TAB_ID
	 * @return  the value of NAV_TAB_VIEW.CHILD_NAV_TAB_ID
	 * @mbg.generated  Sat Aug 17 15:37:50 EDT 2019
	 */
	public Integer getChildNavTabId() {
		return childNavTabId;
	}

	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column NAV_TAB_VIEW.CHILD_NAV_TAB_ID
	 * @param childNavTabId  the value for NAV_TAB_VIEW.CHILD_NAV_TAB_ID
	 * @mbg.generated  Sat Aug 17 15:37:50 EDT 2019
	 */
	public void setChildNavTabId(Integer childNavTabId) {
		this.childNavTabId = childNavTabId;
	}

	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column NAV_TAB_VIEW.PARENT_TAB_ID
	 * @return  the value of NAV_TAB_VIEW.PARENT_TAB_ID
	 * @mbg.generated  Sat Aug 17 15:37:50 EDT 2019
	 */
	public Integer getParentTabId() {
		return parentTabId;
	}

	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column NAV_TAB_VIEW.PARENT_TAB_ID
	 * @param parentTabId  the value for NAV_TAB_VIEW.PARENT_TAB_ID
	 * @mbg.generated  Sat Aug 17 15:37:50 EDT 2019
	 */
	public void setParentTabId(Integer parentTabId) {
		this.parentTabId = parentTabId;
	}

	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column NAV_TAB_VIEW.CHILD_TITLE
	 * @return  the value of NAV_TAB_VIEW.CHILD_TITLE
	 * @mbg.generated  Sat Aug 17 15:37:50 EDT 2019
	 */
	public String getChildTitle() {
		return childTitle;
	}

	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column NAV_TAB_VIEW.CHILD_TITLE
	 * @param childTitle  the value for NAV_TAB_VIEW.CHILD_TITLE
	 * @mbg.generated  Sat Aug 17 15:37:50 EDT 2019
	 */
	public void setChildTitle(String childTitle) {
		this.childTitle = childTitle;
	}

	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column NAV_TAB_VIEW.CHILD_SEQUENCE_NO
	 * @return  the value of NAV_TAB_VIEW.CHILD_SEQUENCE_NO
	 * @mbg.generated  Sat Aug 17 15:37:50 EDT 2019
	 */
	public Integer getChildSequenceNo() {
		return childSequenceNo;
	}

	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column NAV_TAB_VIEW.CHILD_SEQUENCE_NO
	 * @param childSequenceNo  the value for NAV_TAB_VIEW.CHILD_SEQUENCE_NO
	 * @mbg.generated  Sat Aug 17 15:37:50 EDT 2019
	 */
	public void setChildSequenceNo(Integer childSequenceNo) {
		this.childSequenceNo = childSequenceNo;
	}

	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column NAV_TAB_VIEW.LKUP_NAV_SECTION_ID
	 * @return  the value of NAV_TAB_VIEW.LKUP_NAV_SECTION_ID
	 * @mbg.generated  Sat Aug 17 15:37:50 EDT 2019
	 */
	public Integer getLkupNavSectionId() {
		return lkupNavSectionId;
	}

	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column NAV_TAB_VIEW.LKUP_NAV_SECTION_ID
	 * @param lkupNavSectionId  the value for NAV_TAB_VIEW.LKUP_NAV_SECTION_ID
	 * @mbg.generated  Sat Aug 17 15:37:50 EDT 2019
	 */
	public void setLkupNavSectionId(Integer lkupNavSectionId) {
		this.lkupNavSectionId = lkupNavSectionId;
	}

	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column NAV_TAB_VIEW.ALLOW_SELF_FLAG
	 * @return  the value of NAV_TAB_VIEW.ALLOW_SELF_FLAG
	 * @mbg.generated  Sat Aug 17 15:37:50 EDT 2019
	 */
	public Boolean getAllowSelfFlag() {
		return allowSelfFlag;
	}

	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column NAV_TAB_VIEW.ALLOW_SELF_FLAG
	 * @param allowSelfFlag  the value for NAV_TAB_VIEW.ALLOW_SELF_FLAG
	 * @mbg.generated  Sat Aug 17 15:37:50 EDT 2019
	 */
	public void setAllowSelfFlag(Boolean allowSelfFlag) {
		this.allowSelfFlag = allowSelfFlag;
	}
}


text:
import { rimraf, writeFile } from '../../utils/fs';
import { getActivePackageManager } from '../../utils/packages';
import { ng, npm } from '../../utils/process';
import { expectToFail } from '../../utils/utils';

const warningText = 'npm version 7.5.6 or higher is recommended';

export default async function() {
  // Only relevant with npm as a package manager
  if (getActivePackageManager() !== 'npm') {
    return;
  }

  // Windows CI fails with permission errors when trying to replace npm
  if (process.platform.startsWith('win')) {
    return;
  }

  const currentDirectory = process.cwd();
  try {
    // Install version >=7.5.6
    await npm('install', '--global', 'npm@>=7.5.6');

    // Ensure `ng update` does not show npm warning
    const { stderr: stderrUpdate1 } = await ng('update');
    if (stderrUpdate1.includes(warningText)) {
      throw new Error('ng update expected to not show npm version warning.');
    }

    // Install version <7.5.6
    await npm('install', '--global', 'npm@7.4.0');

    // Ensure `ng add` shows npm warning
    const { message: stderrAdd } = await expectToFail(() => ng('add'));
    if (!stderrAdd.includes(warningText)) {
      throw new Error('ng add expected to show npm version warning.');
    }

    // Ensure `ng update` shows npm warning
    const { stderr: stderrUpdate2 } = await ng('update');
    if (!stderrUpdate2.includes(warningText)) {
      throw new Error('ng update expected to show npm version warning.');
    }

    // Ensure `ng build` executes successfully
    const { stderr: stderrBuild } = await ng('build', '--configuration=development');
    if (stderrBuild.includes(warningText)) {
      throw new Error('ng build expected to not show npm version warning.');
    }

    // Ensure `ng new` shows npm warning
    // Must be outside the project for `ng new`
    process.chdir('..');
    const { message: stderrNew } = await expectToFail(() => ng('new'));
    if (!stderrNew.includes(warningText)) {
      throw new Error('ng new expected to show npm version warning.');
    }

    // Ensure `ng new --package-manager=npm` shows npm warning
    const { message: stderrNewNpm } = await expectToFail(() => ng('new', '--package-manager=npm'));
    if (!stderrNewNpm.includes(warningText)) {
      throw new Error('ng new expected to show npm version warning.');
    }

    // Ensure `ng new --skip-install` executes successfully
    const { stderr: stderrNewSkipInstall } = await ng('new', 'npm-seven-skip', '--skip-install');
    if (stderrNewSkipInstall.includes(warningText)) {
      throw new Error('ng new --skip-install expected to not show npm version warning.');
    }

    // Ensure `ng new --package-manager=yarn` executes successfully
    // Need an additional npmrc file since yarn does not use the NPM registry environment variable
    const { stderr: stderrNewYarn } = await ng('new', 'npm-seven-yarn', '--package-manager=yarn');
    if (stderrNewYarn.includes(warningText)) {
      throw new Error('ng new --package-manager=yarn expected to not show npm version warning.');
    }
  } finally {
    // Cleanup extra test projects
    await rimraf('npm-seven-skip');
    await rimraf('npm-seven-yarn');

    // Change directory back
    process.chdir(currentDirectory);

    // Reset version back to 6.x
    await npm('install', '--global', 'npm@6');
  }

}


text:
ZoomPanel::ZoomPanel(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
    : wxPanel(parent, id, pos, size, style)
{
    showPoi = false;
    zoom = 4;
    SetCursor(*wxCROSS_CURSOR);
//    Bind(wxEVT_SIZE, &ZoomPanel::OnResize, this);
}

BEGIN_EVENT_TABLE(ZoomPanel, wxPanel)

    EVT_PAINT(ZoomPanel::paintEvent)
    EVT_SIZE(ZoomPanel::OnResize)

END_EVENT_TABLE()

void ZoomPanel::paintEvent(wxPaintEvent& evt)
{
    wxPaintDC dc(this);
    render(dc);
}

void ZoomPanel::paintNow()
{
    wxPaintDC dc(this);
    render(dc);
}

wxBitmap ZoomPanel::getImage() const
{
    return image;
}

void ZoomPanel::OnResize(wxSizeEvent& event)
{
    UpdateRoi();
    Update();
}

void ZoomPanel::render(wxPaintDC& dc)
{
    if (image.IsOk())
    {
        dc.DrawBitmap(image, 0, 0, false);
        if (showPoi)
        {
            wxGraphicsContext* gc = wxGraphicsContext::Create(dc);
            if (gc)
            {
                int relX = poi.x - roiCorner.x;
                int relY = poi.y - roiCorner.y;
                gc->SetPen(*wxWHITE_PEN);
                gc->SetBrush(wxNullBrush);
                wxGraphicsPath path = gc->CreatePath();
                path.AddCircle(relX * (double)zoom + zoom / 2, relY * (double)zoom + zoom / 2, 5);
                gc->StrokePath(path);
                path = gc->CreatePath();
                path.AddCircle(relX * (double)zoom + zoom / 2, relY * (double)zoom + zoom / 2, 4);
                gc->SetPen(*wxBLACK_PEN);
                gc->StrokePath(path);
                delete gc;
            }
        }
    }
}

wxPoint ZoomPanel::GetPoi() const
{
    return poi;
}

void ZoomPanel::SetPoi(const wxPoint& point)
{
    poi = point;
    ShowPoi(true);
    UpdateRoi();
    Update();
}

int ZoomPanel::GetZoom() const
{
    return zoom;
}

void ZoomPanel::SetZoom(int zoom)
{
    this->zoom = zoom;
    UpdateRoi();
    Update();
}

void ZoomPanel::ShowPoi(bool show)
{
    showPoi = show;
    Refresh();
}

void ZoomPanel::UpdateRoi()
{
    int idx = wxDisplay::GetFromPoint(poi);
    if (idx >= 0) {
        wxDisplay display(idx);
        wxRect geometry = display.GetGeometry();
        wxSize panelSize = GetSize();
        wxSize zoomArea(panelSize.x / zoom, panelSize.y / zoom);
        int relativeX = poi.x - geometry.x;
        int relativeY = poi.y - geometry.y;
        roiCorner.x = geometry.x;
        roiCorner.y = geometry.y;
        if (relativeX > zoomArea.x / 2) {
            if (relativeX > geometry.width - zoomArea.x / 2)
                roiCorner.x = geometry.x + geometry.width - zoomArea.x;
            else
                roiCorner.x = geometry.x + relativeX - zoomArea.x / 2;
        }
        if (relativeY > zoomArea.y / 2) {
            if (relativeY > geometry.height - zoomArea.y / 2)
                roiCorner.y = geometry.y + geometry.height - zoomArea.y;
            else
                roiCorner.y = geometry.y + relativeY - zoomArea.y / 2;
        }
    }
}

void ZoomPanel::Update()
{
    wxSize panelSize = GetSize();
    wxSize zoomArea(panelSize.x / zoom, panelSize.y / zoom);
    int x = roiCorner.x, y = roiCorner.y;
    wxBitmap bitmap(panelSize.x, panelSize.y);
    wxScreenDC dc;
    wxMemoryDC memDC;
    memDC.SelectObject(bitmap);
    memDC.StretchBlit(0, 0, panelSize.x, panelSize.y, &dc, x, y, zoomArea.x, zoomArea.y);
    memDC.SelectObject(wxNullBitmap);
#ifdef __WXGTK3__
    wxSize screenSize = dc.GetSize();
    dc.Blit(0, 0, screenSize.x, screenSize.y, &dc, 0, 0, wxXOR);
#endif
    image = bitmap;
    Refresh();
}


text:
////////////////////////////////////////////////////////////////////////////////
// The MIT License (MIT)
//
// Copyright (c) 2022 Tim Stair
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
////////////////////////////////////////////////////////////////////////////////

using System.Drawing;
using CardMaker.XML;

namespace CardMaker.Card.FormattedText.Alignment
{
    public class HorizontalLeftAlignmentProcessor : HorizontalAlignmentProcessor
    {
        public override float GetHorizontalOffset(ProjectLayoutElement zElement, RectangleF rectFirst, RectangleF rectLast)
        {
#warning This was previously "-rectFirst.X + 1"
            var fXOffset = 1;
            return fXOffset;
        }
    }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Muelleria 7(3): 337 (1991)

#### Original name
Microglaena mawsonii C.W. Dodge

### Remarks
null


text:
using System.Collections.Generic;
using Piccolo.Tasks.Models;
using Piccolo.Tasks.ViewModels;

namespace Piccolo.Tasks.Repositories
{
	public interface ITaskRepository
	{
		IList<Task> GetAll(int pageNumber, int pageSize);
		TaskCollection Search(string term, int pageNumber, int pageSize);
		int Count();
		Task Get(int id);
		void Add(Task task);
		void Update(Task task);
		void Delete(int id);
	}
}


text:
module Main where

import Transient.Base

import Transient.Move
import Transient.Move.Utils
import Transient.Move.Services
import Control.Applicative
import Control.Monad.IO.Class
import Data.List ((\\))

main = keep . runCloud $ do
    runService monitorService $ \(ident,service) -> do
       mnode <-  (local $ findInNodes service >>= return . Just . head) <|>
                  requestInstall ident service
       return (mnode :: Maybe Node)
    where
    installHere ident service@(package,program)= local $ do
        thisNode <-  getMyNode
        yn<- authorizeService ident service   -- !> "AUTHORIZE"
        if yn
          then do
              node <- liftIO $ do
                    port <- freePort
                    putStr "Monitor: installing " >> putStrLn package
                    install package program  (nodeHost thisNode) port
                    putStrLn "INSTALLED"
                    nodeService thisNode port service
              addNodes [node]
              return  $ Just node
          else return Nothing

    requestInstall :: String -> Service -> Cloud (Maybe Node)
    requestInstall ident service= do
        mnode <- installHere ident service          -- !> "INSTALLHERE"
        case mnode of
          Nothing -> installThere ident service
          justnode -> return justnode

    installThere ident service= do
        nodes  <- onAll $ findInNodes monitorService   -- !> "installThere"
        mynode <- onAll getMyNode                      -- !> nodes
        request $ nodes \\ [mynode]
        where
        request []= empty
        request (n:ns)= do
             mnode <- callService' ident n (ident,service)  -- !> ("calling",n)
             case mnode of
                Nothing  -> request ns
                justnode -> return justnode


text:
package com.gs.collections.impl.lazy;

import java.util.Iterator;

import com.gs.collections.api.block.function.Function;
import com.gs.collections.api.block.predicate.Predicate;
import com.gs.collections.api.block.predicate.Predicate2;
import com.gs.collections.api.block.procedure.Procedure;
import com.gs.collections.api.block.procedure.Procedure2;
import com.gs.collections.api.block.procedure.primitive.ObjectIntProcedure;
import com.gs.collections.impl.Counter;
import com.gs.collections.impl.block.factory.Predicates;
import com.gs.collections.impl.lazy.iterator.FlatCollectIterator;
import com.gs.collections.impl.utility.Iterate;
import net.jcip.annotations.Immutable;

@Immutable
public class FlatCollectIterable<T, V>
        extends AbstractLazyIterable<V>
{
    private final Iterable<T> adapted;
    private final Function<? super T, ? extends Iterable<V>> function;

    public FlatCollectIterable(Iterable<T> newAdapted, Function<? super T, ? extends Iterable<V>> function)
    {
        this.adapted = newAdapted;
        this.function = function;
    }

    public void each(final Procedure<? super V> procedure)
    {
        Iterate.forEach(this.adapted, new Procedure<T>()
        {
            public void value(T each)
            {
                Iterate.forEach(FlatCollectIterable.this.function.valueOf(each), procedure);
            }
        });
    }

    @Override
    public void forEachWithIndex(ObjectIntProcedure<? super V> objectIntProcedure)
    {
        final Procedure<V> innerProcedure = new AdaptObjectIntProcedureToProcedure<V>(objectIntProcedure);
        Iterate.forEach(this.adapted, new Procedure<T>()
        {
            public void value(T each)
            {
                Iterable<V> iterable = FlatCollectIterable.this.function.valueOf(each);
                Iterate.forEach(iterable, innerProcedure);
            }
        });
    }

    @Override
    public <P> void forEachWith(final Procedure2<? super V, ? super P> procedure, final P parameter)
    {
        Iterate.forEach(this.adapted, new Procedure<T>()
        {
            public void value(T each)
            {
                Iterate.forEachWith(FlatCollectIterable.this.function.valueOf(each), procedure, parameter);
            }
        });
    }

    @Override
    public V detect(final Predicate<? super V> predicate)
    {
        final V[] result = (V[]) new Object[1];
        Iterate.detect(this.adapted, new Predicate<T>()
        {
            public boolean accept(T each)
            {
                Iterable<V> iterable = FlatCollectIterable.this.function.valueOf(each);
                return Iterate.anySatisfy(iterable, new Predicate<V>()
                {
                    public boolean accept(V each)
                    {
                        if (predicate.accept(each))
                        {
                            result[0] = each;
                            return true;
                        }
                        return false;
                    }
                });
            }
        });
        return result[0];
    }

    @Override
    public boolean anySatisfy(final Predicate<? super V> predicate)
    {
        return Iterate.anySatisfy(this.adapted, new Predicate<T>()
        {
            public boolean accept(T each)
            {
                return Iterate.anySatisfy(FlatCollectIterable.this.function.valueOf(each), predicate);
            }
        });
    }

    @Override
    public <P> boolean anySatisfyWith(Predicate2<? super V, ? super P> predicate, P parameter)
    {
        return this.anySatisfy(Predicates.bind(predicate, parameter));
    }

    @Override
    public boolean allSatisfy(final Predicate<? super V> predicate)
    {
        return Iterate.allSatisfy(this.adapted, new Predicate<T>()
        {
            public boolean accept(T each)
            {
                return Iterate.allSatisfy(FlatCollectIterable.this.function.valueOf(each), predicate);
            }
        });
    }

    @Override
    public <P> boolean allSatisfyWith(Predicate2<? super V, ? super P> predicate, P parameter)
    {
        return this.allSatisfy(Predicates.bind(predicate, parameter));
    }

    @Override
    public boolean noneSatisfy(final Predicate<? super V> predicate)
    {
        return Iterate.noneSatisfy(this.adapted, new Predicate<T>()
        {
            public boolean accept(T each)
            {
                return Iterate.anySatisfy(FlatCollectIterable.this.function.valueOf(each), predicate);
            }
        });
    }

    @Override
    public <P> boolean noneSatisfyWith(Predicate2<? super V, ? super P> predicate, P parameter)
    {
        return this.noneSatisfy(Predicates.bind(predicate, parameter));
    }

    public Iterator<V> iterator()
    {
        return new FlatCollectIterator<T, V>(this.adapted, this.function);
    }

    private static final class AdaptObjectIntProcedureToProcedure<V> implements Procedure<V>
    {
        private static final long serialVersionUID = 1L;

        private final Counter index;
        private final ObjectIntProcedure<? super V> objectIntProcedure;

        private AdaptObjectIntProcedureToProcedure(ObjectIntProcedure<? super V> objectIntProcedure)
        {
            this.objectIntProcedure = objectIntProcedure;
            this.index = new Counter();
        }

        public void value(V each)
        {
            this.objectIntProcedure.value(each, this.index.getCount());
            this.index.increment();
        }
    }
}


text:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Windows;
using System.Windows.Threading;
using System.Xml;

namespace Astchat.Client.Launcher.WPF
{
	/// <summary>
	/// App.xaml 的交互逻辑
	/// </summary>
	public partial class App : Application
	{
		private bool handled = false;
		private object syncObj = new object();

		public App()
		{
			this.DispatcherUnhandledException += this.App_DispatcherUnhandledException;
		}

		private void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
		{
			lock (this.syncObj)
			{
				if (this.handled)
				{
					e.Handled = true;
					return;
				}

				XmlDocument doc = new XmlDocument();
				doc.AppendChild(doc.CreateDocumentFragment());
				XmlElement bugreport = doc.CreateElement("BugReport");
				doc.AppendChild(bugreport);

				#region environment
				XmlElement environment = doc.CreateElement("Environment");
				bugreport.AppendChild(environment);

				XmlElement osversion = doc.CreateElement("OSVersion");
				environment.AppendChild(osversion);
				this.SerializeObject(doc, osversion, Environment.OSVersion);

				#region currentdirectory
				XmlElement currentdirectory = doc.CreateElement("CurrentDirectory");
				environment.AppendChild(currentdirectory);
				currentdirectory.AppendChild(doc.CreateTextNode(Environment.CurrentDirectory));
				#endregion

				#region basedirectory
				XmlElement basedirectory = doc.CreateElement("BaseDirectory");
				environment.AppendChild(basedirectory);
				basedirectory.AppendChild(doc.CreateTextNode(AppDomain.CurrentDomain.BaseDirectory));
				#endregion

				#region version
				XmlElement version = doc.CreateElement("Version");
				environment.AppendChild(version);
				version.AppendChild(doc.CreateTextNode(Environment.Version.ToString()));
				#endregion

				#region machinename
				XmlElement machinename = doc.CreateElement("MachineVersion");
				environment.AppendChild(machinename);
				machinename.AppendChild(doc.CreateTextNode(Environment.MachineName));
				#endregion

				#region processorcount
				XmlElement processorcount = doc.CreateElement("ProcessorCount");
				environment.AppendChild(processorcount);
				processorcount.AppendChild(doc.CreateTextNode(Environment.ProcessorCount.ToString()));
				#endregion

				#region commandline
				XmlElement commandline = doc.CreateElement("CommandLine");
				environment.AppendChild(commandline);
				commandline.AppendChild(doc.CreateTextNode(Environment.CommandLine));
				#endregion

				#region workingset
				XmlElement workingset = doc.CreateElement("WorkingSet");
				environment.AppendChild(workingset);
				workingset.AppendChild(doc.CreateTextNode(Environment.WorkingSet.ToString()));
				#endregion
				#endregion

				XmlElement exception = doc.CreateElement("Exception");
				bugreport.AppendChild(exception);
				exception.SetAttribute("type", e.Exception.GetType().FullName);

				this.SerializeObject(doc, exception, e.Exception);

				string bugreportfile = "__bugreport_" + DateTime.Now.ToString("yyyyMMddHHmmssfff");
				doc.Save(bugreportfile);
				File.SetAttributes(bugreportfile, File.GetAttributes(bugreportfile) | (FileAttributes.Hidden | FileAttributes.ReadOnly));
				//MessageBox.Show(sb.ToString());

#if DEBUG
				Clipboard.SetText(File.ReadAllText(bugreportfile));
#endif

				Process p = new Process();
				p.StartInfo.FileName = "BugReport.exe";
				p.StartInfo.Arguments = string.Format("Astchat Astchat.Client.Launcher.WPF \"{0}\" \"\" \"{1}\"", Process.GetCurrentProcess().MainModule.FileName, bugreportfile);
				p.StartInfo.UseShellExecute = false;
				p.StartInfo.CreateNoWindow = true;
				p.Start();

				this.handled = e.Handled = true;
				Application.Current.Shutdown(-1);
			}
		}

		private void SerializeObject(XmlDocument doc, XmlElement element, object o, int stack = 0)
		{
			if (stack == 8) return;

			try
			{
				if (o == null)
				{
					element.AppendChild(doc.CreateElement("null"));
				}
				else if (
					o is sbyte ||
					o is byte ||
					o is int ||
					o is uint ||
					o is long ||
					o is ulong ||
					o is float ||
					o is double ||
					o is decimal ||
					o is string
				)
				{
					element.AppendChild(doc.CreateTextNode(o.ToString()));
				}
				else if (o is Enum)
				{
					XmlElement enum_element = doc.CreateElement(o.GetType().FullName);
					element.AppendChild(enum_element);
					enum_element.AppendChild(doc.CreateTextNode(o.ToString()));
				}
				else if (o is IDictionary)
				{
					foreach (DictionaryEntry item in (IDictionary)o)
					{
						XmlElement keyvaluepair_element = doc.CreateElement("DictionaryEntry");
						element.AppendChild(keyvaluepair_element);

						XmlElement key_element = doc.CreateElement("Key");
						keyvaluepair_element.AppendChild(key_element);
						this.SerializeObject(doc, key_element, item.Key, stack + 1);

						XmlElement value_element = doc.CreateElement("Value");
						keyvaluepair_element.AppendChild(value_element);
						this.SerializeObject(doc, value_element, item.Value, stack + 1);
					}
				}
				else if (o is IEnumerable)
				{
					foreach (object item in (IEnumerable)o)
					{
						XmlElement item_element = doc.CreateElement("Item");
						element.AppendChild(item_element);
						this.SerializeObject(doc, item_element, o, stack + 1);
					}
				}
				else
				{
					try
					{
						Type t = o.GetType();
						PropertyInfo[] properties = t.GetProperties(BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance);
						foreach (PropertyInfo property in properties)
						{
							if (o is Exception && property.Name == "TargetSite") continue;

							XmlElement property_element = doc.CreateElement(property.Name);
							element.AppendChild(property_element);
							this.SerializeObject(doc, property_element, property.GetValue(o, null), stack + 1);
						}
					}
					catch (Exception)
					{
					}
				}
			}
			catch (StackOverflowException)
			{
			}
		}

		private void SerializeException(XmlDocument doc, Exception e)
		{

		}
	}
}