Total Complexity | 5 |
Total Lines | 101 |
Duplicated Lines | 0 % |
Coverage | 84.62% |
Changes | 0 |
1 | <?php |
||
6 | class Apps extends \Baka\Auth\Models\Apps |
||
7 | { |
||
8 | /** |
||
9 | * |
||
10 | * @var integer |
||
11 | */ |
||
12 | public $id; |
||
13 | |||
14 | /** |
||
15 | * |
||
16 | * @var string |
||
17 | */ |
||
18 | public $name; |
||
19 | |||
20 | /** |
||
21 | * |
||
22 | * @var string |
||
23 | */ |
||
24 | public $description; |
||
25 | |||
26 | /** |
||
27 | * |
||
28 | * @var string |
||
29 | */ |
||
30 | public $url; |
||
31 | |||
32 | /** |
||
33 | * |
||
34 | * @var integer |
||
35 | */ |
||
36 | public $is_actived; |
||
37 | |||
38 | /** |
||
39 | * |
||
40 | * @var string |
||
41 | */ |
||
42 | public $created_at; |
||
43 | |||
44 | /** |
||
45 | * |
||
46 | * @var string |
||
47 | */ |
||
48 | public $updated_at; |
||
49 | |||
50 | /** |
||
51 | * |
||
52 | * @var integer |
||
53 | */ |
||
54 | public $is_deleted; |
||
55 | |||
56 | /** |
||
57 | * Ecosystem default app |
||
58 | * @var string |
||
59 | */ |
||
60 | const GEWAER_DEFAULT_APP_NAME = 'Default'; |
||
61 | |||
62 | /** |
||
63 | * Initialize method for model. |
||
64 | */ |
||
65 | 11 | public function initialize() |
|
66 | { |
||
67 | 11 | parent::initialize(); |
|
68 | |||
69 | 11 | $this->setSource('apps'); |
|
70 | 11 | } |
|
71 | |||
72 | /** |
||
73 | * You can only get 2 variations or default in DB or the api app |
||
74 | * |
||
75 | * @param string $name |
||
76 | * @return Apps |
||
77 | */ |
||
78 | 8 | public static function getACLApp(string $name): Apps |
|
79 | { |
||
80 | 8 | if (trim($name) == self::GEWAER_DEFAULT_APP_NAME) { |
|
81 | 7 | $app = self::findFirst(0); |
|
82 | } else { |
||
83 | 1 | $app = self::findFirst(\Phalcon\DI::getDefault()->getConfig()->app->id); |
|
84 | } |
||
85 | |||
86 | 8 | return $app; |
|
87 | } |
||
88 | |||
89 | /** |
||
90 | * Is active? |
||
91 | * |
||
92 | * @return boolean |
||
93 | */ |
||
94 | public function isActive(): bool |
||
97 | } |
||
98 | |||
99 | /** |
||
100 | * Returns table name mapped in the model. |
||
101 | * |
||
102 | * @return string |
||
103 | */ |
||
104 | 11 | public function getSource() : string |
|
107 | } |
||
108 | } |
||
109 |