Completed
Push — master ( 14e249...611e70 )
by Terry
03:18
created

functions.php ➔ Validate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
c 1
b 0
f 1
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
3
namespace Terah\Assert;
4
5
/**
6
 * @param mixed      $value
7
 * @param bool|false $throwValidationError
8
 * @return Assert
9
 */
10
function Assert($value, $throwValidationError=false)
11
{
12
    if ( ! $throwValidationError )
13
    {
14
        return new Assert($value);
15
    }
16
    return (new Assert($value))->setExceptionClass('Terah\Assert\ValidationFailedException');
17
}
18
19
/**
20
 * @param mixed $value
21
 * @return Assert
22
 */
23
function Validate($value)
24
{
25
    return (new Assert($value))->setExceptionClass('Terah\Assert\ValidationFailedException');
26
}