Passed
Push — master ( 369e19...ee79b9 )
by Travis
02:23
created

AbstractResourceRuleSet   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 28
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A updateRules() 0 5 1
A rules() 0 3 1
A creationRules() 0 5 1
1
<?php
2
3
namespace Telkins\Validation;
4
5
use Illuminate\Support\Str;
6
use Telkins\Validation\Contracts\ResourceRuleSetContract;
7
8
abstract class AbstractResourceRuleSet implements ResourceRuleSetContract
9
{
10
    public function rules() : array
11
    {
12
        return $this->provideRules();
13
    }
14
15
    public function creationRules() : array
16
    {
17
        return array_merge_recursive(
18
            $this->provideRules(),
19
            $this->provideCreationRules()
20
        );
21
    }
22
23
    public function updateRules() : array
24
    {
25
        return array_merge_recursive(
26
            $this->provideRules(),
27
            $this->provideUpdateRules()
28
        );
29
    }
30
31
    abstract protected function provideRules() : array;
32
33
    abstract protected function provideCreationRules() : array;
34
35
    abstract protected function provideUpdateRules() : array;
36
}
37