Passed
Push — master ( 5bb523...a299a9 )
by Smoren
02:16
created

Validate::numeric()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Smoren\Validator\Factories;
6
7
use Smoren\Validator\Interfaces\BaseRuleInterface;
8
use Smoren\Validator\Interfaces\ContainerRuleInterface;
9
use Smoren\Validator\Interfaces\FloatRuleInterface;
10
use Smoren\Validator\Interfaces\IntegerRuleInterface;
11
use Smoren\Validator\Rules\ContainerRule;
12
use Smoren\Validator\Rules\FloatRule;
13
use Smoren\Validator\Rules\IntegerRule;
14
use Smoren\Validator\Rules\NumericRule;
15
use Smoren\Validator\Rules\OrRule;
16
17
class Validate
18
{
19
    /**
20
     * @return NumericRule
21
     */
22
    public static function numeric(): NumericRule
23
    {
24
        return new NumericRule();
25
    }
26
27
    /**
28
     * @return IntegerRuleInterface
29
     */
30
    public static function integer(): IntegerRuleInterface
31
    {
32
        return new IntegerRule();
33
    }
34
35
    /**
36
     * @return FloatRuleInterface
37
     */
38
    public static function float(): FloatRuleInterface
39
    {
40
        return new FloatRule();
41
    }
42
43
    /**
44
     * @return ContainerRuleInterface
45
     */
46
    public static function container(): ContainerRuleInterface
47
    {
48
        return new ContainerRule();
49
    }
50
51
    /**
52
     * @param array<BaseRuleInterface> $rules
53
     * @return OrRule
54
     */
55
    public static function or(array $rules): OrRule
56
    {
57
        return new OrRule($rules);
58
    }
59
}
60