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

functions.php ➔ Assert()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
cc 2
eloc 4
c 2
b 0
f 1
nc 2
nop 2
dl 0
loc 8
rs 9.4285
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
}