Passed
Push — master ( 1a4aeb...c4d310 )
by Nicolaas
03:20
created

ObjectsUpdated   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Importance

Changes 5
Bugs 0 Features 0
Metric Value
eloc 18
dl 0
loc 50
rs 10
c 5
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getitle() 0 7 2
1
<?php
2
3
namespace Sunnysideup\SimpleTemplateCaching\Model;
4
5
use SilverStripe\Core\Injector\Injector;
6
use SilverStripe\ORM\DataObject;
7
8
/**
9
 * A blog category for generalising blog posts.
10
 *
11
 * @property string $ClassNameLastEdited
12
 */
13
class ObjectsUpdated extends DataObject
14
{
15
    /**
16
     * {@inheritDoc}
17
     *
18
     * @var string
19
     */
20
    private static $table_name = 'ObjectsUpdated';
21
22
    /**
23
     * @var array
24
     */
25
    private static $db = [
26
        'ClassNameLastEdited' => 'Varchar(255)',
27
    ];
28
29
    private static $default_sort = [
30
        'ID' => 'DESC',
31
    ];
32
33
    /**
34
     * @var array
35
     */
36
    private static $summary_fields = [
37
        'Created' => 'Updated',
38
        'ClassNameTitle' => 'Record name    ',
39
    ];
40
41
    /**
42
     * @var array
43
     */
44
    private static $field_labels = [
45
        'Created' => 'Updated',
46
        'Title' => 'Human readable name',
47
        'ClassNameLastEdited' => 'Code name',
48
    ];
49
    /**
50
     * @var array
51
     */
52
    private static $casting = [
53
        'Title' => 'Varchar',
54
    ];
55
56
    public function getitle(): string
57
    {
58
        if (class_exists($this->getOwner()->ClassNameLastEdited)) {
0 ignored issues
show
Bug introduced by
The method getOwner() does not exist on Sunnysideup\SimpleTempla...ng\Model\ObjectsUpdated. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

58
        if (class_exists($this->/** @scrutinizer ignore-call */ getOwner()->ClassNameLastEdited)) {
Loading history...
59
            return Injector::inst()->get($this->getOwner()->ClassNameLastEdited)->i18n_singular_name();
60
        }
61
62
        return 'ERROR: class not found';
63
    }
64
}
65