-
Notifications
You must be signed in to change notification settings - Fork 115
Expand file tree
/
Copy pathInvalidArguments.php
More file actions
43 lines (38 loc) · 1.03 KB
/
InvalidArguments.php
File metadata and controls
43 lines (38 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
/**
* PHP Command Line Tools
*
* This source file is subject to the MIT license that is bundled
* with this package in the file LICENSE.
*
* @author James Logsdon <dwarf@girsbrain.org>
* @copyright 2010 James Logsdom (http://girsbrain.org)
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
namespace cli\arguments;
/**
* Thrown when undefined arguments are detected in strict mode.
*/
class InvalidArguments extends \InvalidArgumentException {
protected $arguments;
/**
* @param array $arguments A list of arguments that do not fit the profile.
*/
public function __construct(array $arguments) {
$this->arguments = $arguments;
$this->message = $this->_generateMessage();
}
/**
* Get the arguments that caused the exception.
*
* @return array
*/
public function getArguments() {
return $this->arguments;
}
private function _generateMessage() {
return 'unknown argument' .
(count($this->arguments) > 1 ? 's' : '') .
': ' . join(', ', $this->arguments);
}
}