|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Trucker\Factories; |
|
4
|
|
|
|
|
5
|
|
|
use Trucker\Facades\Config; |
|
6
|
|
|
use Trucker\Framework\FactoryDriver; |
|
7
|
|
|
|
|
8
|
|
|
class AuthFactory extends FactoryDriver |
|
9
|
|
|
{ |
|
10
|
|
|
/** |
|
11
|
|
|
* Function to return a string representaion of the namespace |
|
12
|
|
|
* that all classes built by the factory should be contained within. |
|
13
|
|
|
* |
|
14
|
|
|
* @return string - namespace string |
|
15
|
|
|
*/ |
|
16
|
2 |
|
public function getDriverNamespace() |
|
17
|
|
|
{ |
|
18
|
2 |
|
return "\Trucker\Requests\Auth"; |
|
19
|
|
|
} |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* Function to return the interface that the driver's produced |
|
23
|
|
|
* by the factory must implement. |
|
24
|
|
|
* |
|
25
|
|
|
* @return string |
|
26
|
|
|
*/ |
|
27
|
1 |
|
public function getDriverInterface() |
|
28
|
|
|
{ |
|
29
|
1 |
|
return "\Trucker\Requests\Auth\AuthenticationInterface"; |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Function to return a string that should be suffixed |
|
34
|
|
|
* to the studly-cased driver name of all the drivers |
|
35
|
|
|
* that the factory can return. |
|
36
|
|
|
* |
|
37
|
|
|
* @return string |
|
38
|
|
|
*/ |
|
39
|
2 |
|
public function getDriverNameSuffix() |
|
40
|
|
|
{ |
|
41
|
2 |
|
return 'Authenticator'; |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* Function to return a string that should be prefixed |
|
46
|
|
|
* to the studly-cased driver name of all the drivers |
|
47
|
|
|
* that the factory can return. |
|
48
|
|
|
* |
|
49
|
|
|
* @return string |
|
50
|
|
|
*/ |
|
51
|
2 |
|
public function getDriverNamePrefix() |
|
52
|
|
|
{ |
|
53
|
2 |
|
return ''; |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* Function to return an array of arguments that should be |
|
58
|
|
|
* passed to the constructor of a new driver instance. |
|
59
|
|
|
* |
|
60
|
|
|
* @return array |
|
61
|
|
|
*/ |
|
62
|
1 |
|
public function getDriverArgumentsArray() |
|
63
|
|
|
{ |
|
64
|
1 |
|
return [$this->app]; |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* Function to return the string representation of the driver |
|
69
|
|
|
* itslef based on a value fetched from the config file. This |
|
70
|
|
|
* function will itself access the config, and return the driver |
|
71
|
|
|
* setting. |
|
72
|
|
|
* |
|
73
|
|
|
* @return string |
|
74
|
|
|
*/ |
|
75
|
20 |
|
public function getDriverConfigValue() |
|
76
|
|
|
{ |
|
77
|
20 |
|
return Config::get('auth.driver'); |
|
|
|
|
|
|
78
|
|
|
} |
|
79
|
|
|
} |
|
80
|
|
|
|