Completed
Pull Request — master (#25)
by Greg
02:58
created

InvalidFormatException::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 3
1
<?php
2
namespace Consolidation\OutputFormatters\Exception;
3
4
use Consolidation\OutputFormatters\FormatterInterface;
5
6
/**
7
 * Represents an incompatibility between the output data and selected formatter.
8
 */
9
class InvalidFormatException extends AbstractDataFormatException
10
{
11
    public function __construct($format, $data, $validFormats)
12
    {
13
        $dataDescription = static::describeDataType($data);
14
        $message = "The format $format cannot be used with the data produced by this command, which was $dataDescription.  Valid formats are: " . implode(',', $validFormats);
15
        parent::__construct($message, 1);
16
    }
17
}
18