| @@ 50-63 (lines=14) @@ | ||
| 47 | $this->stringValue = ''; |
|
| 48 | } else { |
|
| 49 | // Validation of values |
|
| 50 | if ($this->IntValue < 0) { |
|
| 51 | $args = [ |
|
| 52 | 'position' => '1st', |
|
| 53 | 'actual' => $intValue, |
|
| 54 | ]; |
|
| 55 | ||
| 56 | $msg = msg('Invalid argument value.'); |
|
| 57 | $msg .= msg( |
|
| 58 | ' {position} argument must to be a positive number; "{actual}" given.', |
|
| 59 | $args |
|
| 60 | ); |
|
| 61 | ||
| 62 | throw new InvalidArgumentException($msg); |
|
| 63 | } // Integer is valid |
|
| 64 | ||
| 65 | if ($stringValue !== null) { |
|
| 66 | if ($this->StringValue != '') { |
|
| @@ 84-97 (lines=14) @@ | ||
| 81 | $correct = strpos($this->StringValue, '--') == false ? true : false; |
|
| 82 | } |
|
| 83 | ||
| 84 | if (!$correct) { |
|
| 85 | $args = [ |
|
| 86 | 'position' => '2nd', |
|
| 87 | 'actual' => $stringValue, |
|
| 88 | ]; |
|
| 89 | ||
| 90 | $msg = msg('Invalid argument value.'); |
|
| 91 | $msg .= msg( |
|
| 92 | ' {position} parameter has invalid chars; "{actual}" given.', |
|
| 93 | $args |
|
| 94 | ); |
|
| 95 | ||
| 96 | throw new InvalidArgumentException($msg); |
|
| 97 | } |
|
| 98 | } |
|
| 99 | } // String is valid |
|
| 100 | } |
|