Completed
Pull Request — master (#64)
by Simone
05:24
created

Resource::rewrites()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/**
4
 * This file is part of sensorario/resources repository
5
 *
6
 * (c) Simone Gentili <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sensorario\Resources;
13
14
use RuntimeException;
15
use Sensorario\Resources\Validators\ResourcesValidator;
16
17
class Resource
18
    extends MagicResource
0 ignored issues
show
Coding Style introduced by
The extends keyword must be on the same line as the class name
Loading history...
Coding Style introduced by
Expected 0 spaces between "MagicResource" and comma; 1 found
Loading history...
19
    implements Interfaces\ResourceInterface
0 ignored issues
show
Coding Style introduced by
The implements keyword must be on the same line as the class name
Loading history...
20
{
21
    protected $allowed = [];
22
23
    protected $allowedValues = [];
24
25
    protected $mandatory = [];
26
27
    protected $defaults = [];
28
29
    protected $rules = [];
30
31
    protected $rewrites = [];
32
33
    public function mandatory()
34
    {
35
        return $this->mandatory;
36
    }
37
38
    public function allowed()
39
    {
40
        return $this->allowed;
41
    }
42
43
    public function allowedValues()
44
    {
45
        return $this->allowedValues;
46
    }
47
48
    public function rules()
49
    {
50
        return $this->rules;
51
    }
52
53
    public function defaults()
54
    {
55
        return $this->defaults;
56
    }
57
58
    public function rewrites()
59
    {
60
        return $this->rewrites;
61
    }
62
63
    public function applyConfiguration(
64
        Configurator $configurator
65
    ) {
66
        $this->allowed       = $configurator->allowed();
67
        $this->mandatory     = $configurator->mandatory();
68
        $this->defaults      = $configurator->defaults();
69
        $this->rules         = $configurator->rules();
70
        $this->allowedValues = $configurator->allowedValues();
71
        $this->rewrites      = $configurator->rewrites();
72
    }
73
}
74