IncompatibleDataException   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 11
rs 10
c 0
b 0
f 0
ccs 7
cts 7
cp 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
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 3
    public function __construct(FormatterInterface $formatter, $data, $allowedTypes)
12
    {
13 3
        $formatterDescription = get_class($formatter);
14 3
        $dataDescription = static::describeDataType($data);
15 3
        $allowedTypesDescription = static::describeAllowedTypes($allowedTypes);
16 3
        $message = "Data provided to $formatterDescription must be $allowedTypesDescription. Instead, $dataDescription was provided.";
17 3
        parent::__construct($message, 1);
18 3
    }
19
}
20