Completed
Push — master ( ee4eef...e76f94 )
by Mahmoud
22:54
created

FindSettingsService::getReferringUserPoints()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace App\Containers\Settings\Services;
4
5
use App\Containers\Settings\Settings\Repositories\SettingsRepository;
6
use App\Port\Service\Abstracts\Service;
7
8
/**
9
 * Class FindSettingsService
10
 *
11
 * @author  Mahmoud Zalt  <[email protected]>
12
 */
13
class FindSettingsService extends Service
14
{
15
16
    /**
17
     * @var  \App\Containers\Settings\Settings\Repositories\SettingsRepository
18
     */
19
    private $settingsRepository;
20
21
    /**
22
     * FindSettingsService constructor.
23
     *
24
     * @param \App\Containers\Settings\Settings\Repositories\SettingsRepository $settingsRepository
25
     */
26
    public function __construct(SettingsRepository $settingsRepository)
27
    {
28
        $this->settingsRepository = $settingsRepository;
29
    }
30
31
    /**
32
     * @param $id
33
     *
34
     * @return  mixed
35
     */
36
    public function byKey($key)
37
    {
38
        $result = $this->settingsRepository->findWhere(['key' => $key])->first();
39
40
        return $result->value;
41
    }
42
43
    /**
44
     * @return  mixed
45
     */
46
    public function getReferringUserPoints()
47
    {
48
        return $this->byKey('referring_user_points');
49
    }
50
51
    /**
52
     * @return  mixed
53
     */
54
    public function getReferredUserPoints()
55
    {
56
        return $this->byKey('referred_user_points');
57
    }
58
59
}
60