Code Duplication    Length = 22-23 lines in 2 locations

src/functions.php 1 location

@@ 28-50 (lines=23) @@
25
 * @param string $level
26
 * @return Assert
27
 */
28
function Validate($value, $name='', $code=0, $error='', $level=Assert::WARNING)
29
{
30
    $assert = new Assert($value);
31
    $assert->setExceptionClass('Terah\Assert\ValidationFailedException');
32
    if ( $name )
33
    {
34
        $assert->name($name);
35
    }
36
    if ( $code )
37
    {
38
        $assert->code($code);
39
    }
40
    if ( $error )
41
    {
42
        $assert->error($error);
43
    }
44
    if ( $level )
45
    {
46
        $assert->level($level);
47
    }
48
49
    return $assert;
50
}

src/Assert.php 1 location

@@ 151-172 (lines=22) @@
148
     * @param string $level
149
     * @return Assert
150
     */
151
    public static function that($value, $name='', $code=0, $error='', $level=Assert::WARNING)
152
    {
153
        $assert = new static($value);
154
        if ( $name )
155
        {
156
            $assert->name($name);
157
        }
158
        if ( $code )
159
        {
160
            $assert->code($code);
161
        }
162
        if ( $error )
163
        {
164
            $assert->error($error);
165
        }
166
        if ( $level )
167
        {
168
            $assert->level($level);
169
        }
170
171
        return $assert;
172
    }
173
174
    /**
175
     * @param mixed $value