Test Setup Failed
Push — master ( 67c757...e205b4 )
by Php Easy Api
03:32
created

ConfigProvider::getRequest()   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
        $model = $this->getModel();
102
103
        if($model=="Default"){
104
105
            return $this->driverDefaultNamespace.'\\'.$this->getDriver().'\\UserBuilder';
106
        }
107
    }
108
109
    /**
110
     * get driver for authenticate
111
     *
112
     * @return string
113
     */
114
    public function getDriver()
115
    {
116
        return 'Eloquent';
117
    }
118
119
    /**
120
     * get driver namespace
121
     *
122
     * @return string
123
     */
124
    public function getDriverNamespace()
125
    {
126
        $this->getModel();
127
128
        if($this->model=="Default"){
129
130
            return $this->driverDefaultNamespace.'\\'.$this->getDriver().'\\User';
131
        }
132
133
        return $this->model;
134
    }
135
136
    /**
137
     * get http for authenticate
138
     *
139
     * @return string
140
     */
141
    public function getHttp()
142
    {
143
        return $this->config['guard'][$this->guard]['http'];
144
    }
145
146
    /**
147
     * get model for authenticate
148
     *
149
     * @return string
150
     */
151
    public function getModel()
152
    {
153
        $this->model = ucfirst($this->config['guard'][$this->guard]['model']);
154
155
        return $this->model;
156
    }
157
158
    /**
159
     * get request for authenticate
160
     *
161
     * @return string
162
     */
163
    public function getRequest()
164
    {
165
        return ucfirst($this->config['guard'][$this->guard]['request']);
166
    }
167
168
    /**
169
     * get token key for authenticate
170
     *
171
     * @return string
172
     */
173
    public function getTokenKey()
174
    {
175
        return $this->config['guard'][$this->guard]['key'];
176
    }
177
178
    /**
179
     * set authenticate needs
180
     *
181
     * @return void|mixed
182
     */
183
    protected function setAuthenticateNeeds()
184
    {
185
        $this->getDriver();
186
187
        $this->getModel();
188
    }
189
190
    /**
191
     * store for authenticate
192
     *
193
     * @param $store
194
     * @return $this
195
     */
196
    public function store($store)
197
    {
198
        $this->store = $store;
199
200
        return $this;
201
    }
202
203
}