Code Duplication    Length = 8-11 lines in 2 locations

src/Util.php 2 locations

@@ 70-80 (lines=11) @@
67
     * @throws Exception if $valueToEnsure !== $valueToCheck
68
     * @throws InvalidArgumentException if $exception was not null, a string, or an Exception
69
     */
70
    public static function ensure($valueToEnsure, $valueToCheck, $exception = null, array $exceptionArgs = null)
71
    {
72
        if ($valueToEnsure !== $valueToCheck) {
73
            throw self::buildException(
74
                $exception ?: "'{$valueToEnsure}' did not equal '{$valueToCheck}'",
75
                $exceptionArgs
76
            );
77
        }
78
79
        return $valueToCheck;
80
    }
81
82
    /**
83
     * Ensures that $valueToThrowOn is not equal to $valueToCheck or it throws
@@ 104-111 (lines=8) @@
101
     * @throws Exception if $valueToThrowOn === $valueToCheck
102
     * @throws InvalidArgumentException if $exception was not null, a string, or an Exception
103
     */
104
    public static function ensureNot($valueToThrowOn, $valueToCheck, $exception = null, array $exceptionArgs = null)
105
    {
106
        if ($valueToThrowOn === $valueToCheck) {
107
            throw self::buildException($exception ?: "'{$valueToThrowOn}' equals '{$valueToCheck}'", $exceptionArgs);
108
        }
109
110
        return $valueToCheck;
111
    }
112
113
    /**
114
     * Helper method to return exception created from ensure[Not] call input.