Completed
Branch feature/split-orm (60a911)
by Anton
03:15
created

MutatorsConfig   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

1 Method

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