ModelsResolver   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 47
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A field() 0 4 1
A fieldValue() 0 4 1
A morphName() 0 4 1
1
<?php
2
3
namespace Laravel\ProductFields;
4
5
use Illuminate\Contracts\Config\Repository;
6
7
class ModelsResolver
8
{
9
    /**
10
     * @var Repository
11
     */
12
    protected $settings;
13
14
    /**
15
     * ModelsResolver constructor.
16
     *
17
     * @param Repository $settings
18
     */
19
    public function __construct(Repository $settings)
20
    {
21
        $this->settings = $settings;
22
    }
23
24
    /**
25
     * Get the Field model name.
26
     *
27
     * @return string
28
     */
29
    public function field(): string
30
    {
31
        return $this->settings->get('product-fields.models.field');
32
    }
33
34
    /**
35
     * Get the FieldValue model name.
36
     *
37
     * @return string
38
     */
39
    public function fieldValue(): string
40
    {
41
        return $this->settings->get('product-fields.models.field_value');
42
    }
43
44
    /**
45
     * Get the polymorphic relation name.
46
     *
47
     * @return string
48
     */
49
    public function morphName(): string
50
    {
51
        return $this->settings->get('product-fields.morph_name', 'fieldable');
52
    }
53
}
54