Test Setup Failed
Push — master ( f0f097...c6f3d6 )
by Php Easy Api
04:31
created

ConfigProvider::getExpire()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Resta\Authenticate;
4
5
use Store\Services\HttpSession as Session;
0 ignored issues
show
Bug introduced by
The type Store\Services\HttpSession was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
7
class ConfigProvider
8
{
9
    /**
10
     * @var string
11
     */
12
    protected $driverDefaultNamespace = "\Resta\Authenticate\Driver";
13
14
    /**
15
     * @var string $store
16
     */
17
    protected $store = 'session';
18
19
    /**
20
     * @var null|mixed
21
     */
22
    protected $config;
23
24
    /**
25
     * @var string
26
     */
27
    protected $driver;
28
29
    /**
30
     * @var null|mixed
31
     */
32
    protected $model;
33
34
    /**
35
     * ConfigProvider constructor.
36
     */
37
    public function __construct()
38
    {
39
        $this->config();
40
41
        if($this->guard=="default"){
42
            $this->setAuthenticateNeeds();
43
        }
44
    }
45
46
    /**
47
     * get authenticate config values
48
     *
49
     * @return void|mixed
50
     */
51
    public function config()
52
    {
53
        $this->config = config('authenticate');
54
55
        return $this->config;
56
    }
57
58
    /**
59
     * auth client query
60
     *
61
     * @return string
62
     */
63
    public function getAddToWhere()
64
    {
65
        if(isset($this->config['guard'][$this->guard]['addToWhere'])){
66
            return $this->config['guard'][$this->guard]['addToWhere'];
67
        }
68
        return null;
69
    }
70
71
    /**
72
     * get config token
73
     *
74
     * @return string
75
     */
76
    public function getConfigToken()
77
    {
78
        if(isset($this->config['guard'][$this->guard]['token'])){
79
            return $this->config['guard'][$this->guard]['token'];
80
        }
81
        return null;
82
    }
83
84
    /**
85
     * get credentials
86
     *
87
     * @return string
88
     */
89
    public function getCredentials()
90
    {
91
        return $this->config['guard'][$this->guard]['credentials'];
92
    }
93
94
    /**
95
     * get driver builder namespace
96
     *
97
     * @return string
98
     */
99
    public function getDriverBuilderNamespace()
100
    {
101
        $this->getModel();
102
103
        if($this->model=="Default"){
104
105
            return $this->driverDefaultNamespace.'\\'.$this->getDriver().'\\UserBuilder';
106
        }
107
108
        return $this->model;
109
    }
110
111
    /**
112
     * get driver for authenticate
113
     *
114
     * @return string
115
     */
116
    public function getDriver()
117
    {
118
        return 'Eloquent';
119
    }
120
121
    /**
122
     * get driver namespace
123
     *
124
     * @return string
125
     */
126
    public function getDriverNamespace()
127
    {
128
        $this->getModel();
129
130
        if($this->model=="Default"){
131
132
            return $this->driverDefaultNamespace.'\\'.$this->getDriver().'\\User';
133
        }
134
135
        return $this->model;
136
    }
137
138
    /**
139
     * get expire for authenticate
140
     * 
141
     * @return mixed
142
     */
143
    public function getExpire()
144
    {
145
        return $this->config['guard'][$this->guard]['expire'];
146
    }
147
148
    /**
149
     * get http for authenticate
150
     *
151
     * @return string
152
     */
153
    public function getHttp()
154
    {
155
        return $this->config['guard'][$this->guard]['http'];
156
    }
157
158
    /**
159
     * get model for authenticate
160
     *
161
     * @return string
162
     */
163
    public function getModel()
164
    {
165
        $this->model = ucfirst($this->config['guard'][$this->guard]['model']);
166
167
        return $this->model;
168
    }
169
170
    /**
171
     * get request for authenticate
172
     *
173
     * @return string
174
     */
175
    public function getRequest()
176
    {
177
        return ucfirst($this->config['guard'][$this->guard]['request']);
178
    }
179
180
    /**
181
     * get token key for authenticate
182
     *
183
     * @return string
184
     */
185
    public function getTokenKey()
186
    {
187
        return $this->config['guard'][$this->guard]['key'];
188
    }
189
190
    /**
191
     * set authenticate needs
192
     *
193
     * @return void|mixed
194
     */
195
    protected function setAuthenticateNeeds()
196
    {
197
        $this->getDriver();
198
199
        $this->getModel();
200
    }
201
202
    /**
203
     * store for authenticate
204
     *
205
     * @param $store
206
     * @return $this
207
     */
208
    public function store($store)
209
    {
210
        $this->store = $store;
211
212
        return $this;
213
    }
214
215
}