Passed
Pull Request — master (#55)
by Rafael
08:50
created

AppsSettingsTrait::getDefaultAppsSettingsByName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 6
ccs 5
cts 5
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gewaer\Traits;
6
7
use Gewaer\Models\Apps;
8
use Gewaer\Models\AppsSettings;
9
use Gewaer\Exception\ServerErrorHttpException;
10
use Gewaer\Exception\ModelException;
11
12
/**
13
 * Trait ResponseTrait
14
 *
15
 * @package Gewaer\Traits
16
 *
17
 * @property Users $user
18
 * @property Config $config
19
 * @property Request $request
20
 * @property Auth $auth
21
 * @property \Phalcon\Di $di
22
 *
23
 */
24
trait AppsSettingsTrait
25
{
26
    /**
27
     * Get default Apps Settings value by name
28
     * @param $name
29
     * @return string
30
     */
31 3
    public function getDefaultAppsSettingsByName(string $name): string
32
    {
33 3
        return AppsSettings::findFirst([
34 3
            'conditions'=>'apps_id = ?0 and name = ?1 and is_deleted = 0',
35 3
            'bind'=>[Apps::GEWAER_DEFAULT_APP_ID,$name]
36 3
        ])->value;
37
    }
38
}