Completed
Push — master ( a47a63...7aba9f )
by Nikola
9s
created

InvalidCompositeConstraintException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 16
ccs 8
cts 8
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A forType() 0 4 1
A forConstraint() 0 8 2
1
<?php
2
3
/**
4
 * This file is part of the Version package.
5
 *
6
 * Copyright (c) Nikola Posa <[email protected]>
7
 *
8
 * For full copyright and license information, please refer to the LICENSE file,
9
 * located at the package root folder.
10
 */
11
12
namespace Version\Exception;
13
14
use DomainException;
15
use Version\Constraint\ConstraintInterface;
16
17
/**
18
 * @author Nikola Posa <[email protected]>
19
 */
20
class InvalidCompositeConstraintException extends DomainException implements Exception
21
{
22 1
    public static function forType($type)
23
    {
24 1
        return new self(sprintf('Unsupported type: %s', $type));
25
    }
26
27 1
    public static function forConstraint($constraint)
28
    {
29 1
        return new self(sprintf(
30 1
            'Constraints should be %s instances; %s given',
31 1
            ConstraintInterface::class,
32 1
            is_object($constraint) ? get_class($constraint) : gettype($constraint)
33 1
        ));
34
    }
35
}
36