LangEntity   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getByNamespace() 0 3 1
1
<?php
2
3
/**
4
 * @author    Donatas Navidonskis <[email protected]>
5
 * @since     2017
6
 * @class     LangEntity
7
 *
8
 * @property int    ModuleID
9
 * @property string Namespace
10
 * @property string Value
11
 * @property string Title
12
 *
13
 * @method LangModule Module
14
 */
15
class LangEntity extends DataObject {
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
16
17
    /**
18
     * @var array
19
     * @config
20
     */
21
    private static $db = [
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
Unused Code introduced by
The property $db is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
22
        'Namespace' => 'Varchar(318)',
23
        'Value'     => 'Varchar(318)',
24
        'Title'     => 'Varchar(512)',
25
    ];
26
27
    /**
28
     * @var array
29
     * @config
30
     */
31
    private static $translate = ['Value'];
0 ignored issues
show
Unused Code introduced by
The property $translate is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
32
33
    /**
34
     * @var array
35
     * @config
36
     */
37
    private static $extensions = ['FluentExtension'];
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
Unused Code introduced by
The property $extensions is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
38
39
    /**
40
     * @var array
41
     * @config
42
     */
43
    private static $has_one = [
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
Unused Code introduced by
The property $has_one is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
44
        'Module' => 'LangModule',
45
    ];
46
47
    /**
48
     * @var array
49
     * @config
50
     */
51
    private static $create_table_options = [
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
Unused Code introduced by
The property $create_table_options is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
52
        'MySQLDatabase' => 'ENGINE=MyISAM',
53
    ];
54
55
    /**
56
     * @var array
57
     * @config
58
     */
59
    private static $indexes = [
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
Unused Code introduced by
The property $indexes is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
60
        'SearchFields' => [
61
            'type'  => 'fulltext',
62
            'name'  => 'SearchFields',
63
            'value' => '"Namespace", "Value", "Title"',
64
        ],
65
    ];
66
67
    /**
68
     * @param string $namespace
69
     *
70
     * @return LangEntity
71
     */
72
    public static function getByNamespace($namespace) {
73
        return static::get()->filter('Namespace', $namespace)->first();
74
    }
75
}