Completed
Pull Request — develop (#9)
by Daan van
79:41 queued 49:00
created

InvalidArgumentException::__construct()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 9
rs 9.6666
cc 3
eloc 4
nc 2
nop 5
1
<?php
2
3
namespace OpenConext\Value\Exception;
4
5
use Assert\InvalidArgumentException as InvalidAssertionException;
6
7
class InvalidArgumentException extends InvalidAssertionException implements OpenConextValueException
8
{
9
    // according to CS used, propertypath and value should be switched, but that breaks the integration with the library
10
    // @codingStandardsIgnoreStart
11
    public function __construct($message, $code, $propertyPath = null, $value, array $constraints = array())
12
    {
13
        // @codingStandardsIgnoreEnd
14
        if ($propertyPath !== null && strpos($message, $propertyPath) === false) {
15
            $message = sprintf('Invalid argument given for "%s": %s', $propertyPath, $message);
16
        }
17
18
        parent::__construct($message, $code, $propertyPath, $value, $constraints);
19
    }
20
}
21