Completed
Push — master ( 838a39...006edc )
by Carlos
04:45
created

Report::tableName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * This file is part of FacturaScripts
4
 * Copyright (C) 2019 Carlos Garcia Gomez <[email protected]>
5
 *
6
 * This program is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU Lesser General Public License as
8
 * published by the Free Software Foundation, either version 3 of the
9
 * License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
 * GNU Lesser General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Lesser General Public License
17
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18
 */
19
namespace FacturaScripts\Core\Model;
20
21
/**
22
 * Description of Report
23
 *
24
 * @author Carlos Garcia Gomez <[email protected]>
25
 */
26
class Report extends Base\ModelClass
27
{
28
29
    use Base\ModelTrait;
30
31
    const DEFAULT_TYPE = 'area';
32
33
    /**
34
     *
35
     * @var int
36
     */
37
    public $compared;
38
39
    /**
40
     *
41
     * @var int
42
     */
43
    public $id;
44
45
    /**
46
     *
47
     * @var string
48
     */
49
    public $name;
50
51
    /**
52
     *
53
     * @var string
54
     */
55
    public $table;
56
57
    /**
58
     *
59
     * @var string
60
     */
61
    public $type;
62
63
    /**
64
     *
65
     * @var string
66
     */
67
    public $xcolumn;
68
69
    /**
70
     *
71
     * @var string
72
     */
73
    public $xoperation;
74
75
    /**
76
     *
77
     * @var string
78
     */
79
    public $ycolumn;
80
81
    public function clear()
82
    {
83
        parent::clear();
84
        $this->type = self::DEFAULT_TYPE;
85
    }
86
87
    /**
88
     * 
89
     * @return string
90
     */
91
    public static function primaryColumn(): string
92
    {
93
        return 'id';
94
    }
95
96
    /**
97
     * 
98
     * @return string
99
     */
100
    public function primaryDescriptionColumn(): string
101
    {
102
        return 'name';
103
    }
104
105
    /**
106
     * 
107
     * @return string
108
     */
109
    public static function tableName(): string
110
    {
111
        return 'reports';
112
    }
113
114
    /**
115
     * 
116
     * @return bool
117
     */
118
    public function test()
119
    {
120
        $utils = $this->toolBox()->utils();
121
        $this->name = $utils->noHtml($this->name);
122
        $this->table = $utils->noHtml($this->table);
123
        $this->type = $utils->noHtml($this->type);
124
        $this->xcolumn = $utils->noHtml($this->xcolumn);
125
        $this->xoperation = $utils->noHtml($this->xoperation);
126
        $this->ycolumn = $utils->noHtml($this->ycolumn);
127
        return parent::test();
128
    }
129
}
130