Completed
Pull Request — master (#56)
by Simone
02:30
created

Resource   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 9
Bugs 1 Features 3
Metric Value
wmc 5
c 9
b 1
f 3
lcom 1
cbo 2
dl 0
loc 33
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A mandatory() 0 4 1
A allowed() 0 4 1
A allowedValues() 0 4 1
A rules() 0 4 1
A applyConfiguration() 0 6 1
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
16
class Resource
17
    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...
18
    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...
19
{
20
    protected static $allowed = [];
21
22
    public static function mandatory()
23
    {
24
        return [];
25
    }
26
27
    public static function allowed()
28
    {
29
        return static::$allowed;
30
    }
31
32
    public static function allowedValues()
33
    {
34
        return [];
35
    }
36
37
    public static function rules()
38
    {
39
        return [];
40
    }
41
42
    public function applyConfiguration(
43
        $resourceName,
44
        Container $config
45
    ) {
46
        static::$allowed = $config->allowed($resourceName);
47
    }
48
}
49