| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace Endroid\QrCode\Exception; |
| 6 |
|
| 7 |
final class ValidationException extends \Exception |
| 8 |
{ |
| 9 |
public static function createForUnsupportedWriter(string $writerClass): self |
| 10 |
{ |
| 11 |
return new self(sprintf('Unable to validate the result: "%s" does not support validation', $writerClass)); |
| 12 |
} |
| 13 |
|
| 14 |
public static function createForMissingPackage(string $packageName): self |
| 15 |
{ |
| 16 |
return new self(sprintf('Please install "%s" or disable image validation', $packageName)); |
| 17 |
} |
| 18 |
|
| 19 |
public static function createForInvalidData(string $expectedData, string $actualData): self |
| 20 |
{ |
| 21 |
return new self('The validation reader read "'.$actualData.'" instead of "'.$expectedData.'". Adjust your parameters to increase readability or disable validation.'); |
| 22 |
} |
| 23 |
} |