MutatorsConfig   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 32
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getMutators() 0 7 2
1
<?php
2
/**
3
 * Spiral Framework.
4
 *
5
 * @license MIT
6
 * @author  Anton Titov (Wolfy-J)
7
 */
8
9
namespace Spiral\ORM\Configs;
10
11
use Spiral\Core\InjectableConfig;
12
use Spiral\Core\Traits\Config\AliasTrait;
13
14
/**
15
 *  Provides set of rules and aliases for automatic mutations for Record fields.
16
 */
17
class MutatorsConfig extends InjectableConfig
18
{
19
    use AliasTrait;
20
21
    /**
22
     * Configuration section.
23
     */
24
    const CONFIG = 'schemas/records';
25
26
    /**
27
     * @var array
28
     */
29
    protected $config = [
30
        'aliases'  => [],
31
        'mutators' => []
32
    ];
33
34
    /**
35
     * Get list of mutators associated with given field type.
36
     *
37
     * @param string $type
38
     *
39
     * @return array
40
     */
41
    public function getMutators(string $type): array
42
    {
43
        $type = $this->resolveAlias($type);
44
        $mutators = $this->config['mutators'];
45
46
        return isset($mutators[$type]) ? $mutators[$type] : [];
47
    }
48
}
49