| Total Complexity | 3 |
| Total Lines | 52 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 4 | class ParserException extends \RuntimeException |
||
| 5 | { |
||
| 6 | const SQUARE_BRACKET_MISMATCH = 1; |
||
| 7 | |||
| 8 | const DUPLICATE_PLACEHOLDER = 2; |
||
| 9 | |||
| 10 | const PLACEHOLDER_EXCEEDED = 3; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * The missing placeholder name. |
||
| 14 | * |
||
| 15 | * @var string |
||
| 16 | */ |
||
| 17 | public $placeholder = ''; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * The error code. |
||
| 21 | * |
||
| 22 | * @var integer |
||
| 23 | */ |
||
| 24 | protected $code = 500; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Creates a square bracket mismatch exception. |
||
| 28 | * |
||
| 29 | * @return object |
||
| 30 | */ |
||
| 31 | public static function squareBracketMismatch() |
||
| 32 | { |
||
| 33 | 1 | return new static("Number of opening '[' and closing ']' does not match.", static::SQUARE_BRACKET_MISMATCH); |
|
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Creates a duplicate placeholder exception. |
||
| 38 | * |
||
| 39 | * @return object |
||
| 40 | */ |
||
| 41 | public static function duplicatePlaceholder($placeholder = '') |
||
| 42 | { |
||
| 43 | 2 | $exception = new static("Cannot use the same placeholder `{$placeholder}` twice.", static::DUPLICATE_PLACEHOLDER); |
|
| 44 | 2 | $exception->placeholder = $placeholder; |
|
| 45 | 2 | return $exception; |
|
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Creates a placeholder exceeded exception. |
||
| 50 | * |
||
| 51 | * @return object |
||
| 52 | */ |
||
| 53 | public static function placeholderExceeded() |
||
| 56 | } |
||
| 57 | } |
||
| 58 |