amercier/php-cli-helpers

View on GitHub
src/Cli/Helpers/Exception/MissingParameterValue.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 a required
 * parameter is given with no value. Ex:
 *
 *     my-script.php -u
 */
class MissingParameterValue extends CliHelpersException
{
    public function __construct($parameter, $arguments)
    {
        global $argv;
        parent::__construct(
            'Missing value for parameter -' . $parameter->getShort() . '/--' . $parameter->getLong()
            . ' in command "php ' . implode(' ', $arguments) . '"'
        );
    }
}