ca13a65f48138dc0e14aa4b6bf34f2a057b1ebb5
[yaffs-website] / vendor / consolidation / output-formatters / src / Exception / IncompatibleDataException.php
1 <?php
2 namespace Consolidation\OutputFormatters\Exception;
3
4 use Consolidation\OutputFormatters\Formatters\FormatterInterface;
5
6 /**
7  * Represents an incompatibility between the output data and selected formatter.
8  */
9 class IncompatibleDataException extends AbstractDataFormatException
10 {
11     public function __construct(FormatterInterface $formatter, $data, $allowedTypes)
12     {
13         $formatterDescription = get_class($formatter);
14         $dataDescription = static::describeDataType($data);
15         $allowedTypesDescription = static::describeAllowedTypes($allowedTypes);
16         $message = "Data provided to $formatterDescription must be $allowedTypesDescription. Instead, $dataDescription was provided.";
17         parent::__construct($message, 1);
18     }
19 }