Completed
Push — master ( 614b30...987f85 )
by Ryan
02:24
created

ConfigureSystem::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
1
<?php namespace Anomaly\PreferencesModule\Preference\Listener;
2
3
use Anomaly\PreferencesModule\Preference\Contract\PreferenceRepositoryInterface;
4
use Illuminate\Contracts\Bus\SelfHandling;
5
use Illuminate\Contracts\Config\Repository;
6
7
/**
8
 * Class ConfigureSystem
9
 *
10
 * @link          http://pyrocms.com/
11
 * @author        PyroCMS, Inc. <[email protected]>
12
 * @author        Ryan Thompson <[email protected]>
13
 * @package       Anomaly\PreferencesModule\Preference\Listener
14
 */
15
class ConfigureSystem
16
{
17
18
    /**
19
     * The config repository.
20
     *
21
     * @var Repository
22
     */
23
    protected $config;
24
25
    /**
26
     * The preferences repository.
27
     *
28
     * @var PreferenceRepositoryInterface
29
     */
30
    protected $preferences;
31
32
    /**
33
     * Create a new ConfigureSystem instance.
34
     *
35
     * @param PreferenceRepositoryInterface $preferences
36
     * @param Repository                    $config
37
     */
38
    public function __construct(PreferenceRepositoryInterface $preferences, Repository $config)
39
    {
40
        $this->config      = $config;
41
        $this->preferences = $preferences;
42
    }
43
44
45
    /**
46
     * Handle the event.
47
     */
48
    public function handle()
49
    {
50
        $this->config->set('app.debug', $this->preferences->value('streams::debug', $this->config->get('app.debug')));
51
        $this->config->set('app.timezone', $this->preferences->value('streams::timezone', $this->config->get('app.timezone')));
52
53
        $this->config->set('streams::system.per_page', $this->preferences->value('streams::per_page', 15));
54
    }
55
}
56