Mercurial > hg > isophonics-drupal-site
annotate vendor/consolidation/output-formatters/src/Exception/IncompatibleDataException.php @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | 4c8ae668cc8c |
children |
rev | line source |
---|---|
Chris@0 | 1 <?php |
Chris@0 | 2 namespace Consolidation\OutputFormatters\Exception; |
Chris@0 | 3 |
Chris@0 | 4 use Consolidation\OutputFormatters\Formatters\FormatterInterface; |
Chris@0 | 5 |
Chris@0 | 6 /** |
Chris@0 | 7 * Represents an incompatibility between the output data and selected formatter. |
Chris@0 | 8 */ |
Chris@0 | 9 class IncompatibleDataException extends AbstractDataFormatException |
Chris@0 | 10 { |
Chris@0 | 11 public function __construct(FormatterInterface $formatter, $data, $allowedTypes) |
Chris@0 | 12 { |
Chris@0 | 13 $formatterDescription = get_class($formatter); |
Chris@0 | 14 $dataDescription = static::describeDataType($data); |
Chris@0 | 15 $allowedTypesDescription = static::describeAllowedTypes($allowedTypes); |
Chris@0 | 16 $message = "Data provided to $formatterDescription must be $allowedTypesDescription. Instead, $dataDescription was provided."; |
Chris@0 | 17 parent::__construct($message, 1); |
Chris@0 | 18 } |
Chris@0 | 19 } |