amercier/php-cli-helpers

View on GitHub
src/Cli/Helpers/Exception/ConflictingParameters.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
<?php

namespace Cli\Helpers\Exception;

use Cli\Helpers\Exception as CliHelpersException;

/**
 * Exception that occurs with Parameter::getFromCommandLine() where both a short
 * parameter and its long equivalent are given simulteanously. Ex:
 *
 *     my-script.php -u amercier --username amercier
 */
class ConflictingParameters extends CliHelpersException
{
    public function __construct($parameter, $arguments)
    {
        parent::__construct(
            'Conflicting parameters -' . $parameter->getShort()
            . ' and --' . $parameter->getLong()
            . ' in command "php ' . implode(' ', $arguments) . '"'
        );
    }
}