1
|
|
|
<?php |
2
|
|
|
namespace Germania\UserProfiles\Providers; |
3
|
|
|
|
4
|
|
|
use Pimple\Container; |
5
|
|
|
use Pimple\ServiceProviderInterface; |
6
|
|
|
|
7
|
|
|
class PimpleServiceProvider implements ServiceProviderInterface |
8
|
|
|
{ |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* @param Container $dic Pimple Dependency Injection Container |
12
|
|
|
* @implements ServiceProviderInterface |
13
|
|
|
*/ |
14
|
4 |
|
public function register(Container $dic) |
15
|
|
|
{ |
16
|
|
|
|
17
|
1 |
|
$dic['Profiles.Config'] = function( $dic ) { |
|
|
|
|
18
|
|
|
$fieldconfig = [ |
19
|
5 |
|
'required' => [], |
20
|
1 |
|
'optional' => [] |
21
|
1 |
|
]; |
22
|
|
|
|
23
|
|
|
return [ |
24
|
5 |
|
'reset' => $fieldconfig, |
25
|
5 |
|
'change_password' => $fieldconfig, |
26
|
5 |
|
'change_profile' => $fieldconfig, |
27
|
5 |
|
'login' => $fieldconfig, |
28
|
5 |
|
'reset_password' => $fieldconfig, |
29
|
5 |
|
'register' => $fieldconfig, |
30
|
5 |
|
'signup' => $fieldconfig, |
31
|
5 |
|
'edit_profile' => $fieldconfig, |
32
|
1 |
|
]; |
33
|
|
|
}; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @return StdClass |
37
|
|
|
*/ |
38
|
1 |
|
$dic['Profiles.Login'] = function( $dic ) { |
39
|
5 |
|
return $dic['Profiles.Config']['login']; |
40
|
|
|
}; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @return array |
44
|
|
|
*/ |
45
|
1 |
|
$dic['Profiles.Login.required'] = function( $dic ) { |
46
|
5 |
|
return $dic['Profiles.Login']['required']; |
47
|
|
|
}; |
48
|
|
|
|
49
|
|
|
|
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @return StdClass |
53
|
|
|
*/ |
54
|
1 |
|
$dic['Profiles.ResetPassword'] = function( $dic ) { |
55
|
5 |
|
return $dic['Profiles.Config']['reset_password']; |
56
|
|
|
}; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @return array |
60
|
|
|
*/ |
61
|
1 |
|
$dic['Profiles.ResetPassword.required'] = function( $dic ) { |
62
|
5 |
|
return $dic['Profiles.ResetPassword']['required']; |
63
|
|
|
}; |
64
|
|
|
/** |
65
|
|
|
* @return array |
66
|
|
|
*/ |
67
|
1 |
|
$dic['Profiles.ResetPassword.optional'] = function( $dic ) { |
68
|
5 |
|
return $dic['Profiles.ResetPassword']['optional']; |
69
|
|
|
}; |
70
|
|
|
|
71
|
|
|
|
72
|
|
|
|
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @return StdClass |
76
|
|
|
*/ |
77
|
1 |
|
$dic['Profiles.Register'] = function( $dic ) { |
78
|
5 |
|
return $dic['Profiles.Config']['register']; |
79
|
|
|
}; |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @return array |
83
|
|
|
*/ |
84
|
1 |
|
$dic['Profiles.Register.required'] = function( $dic ) { |
85
|
5 |
|
return $dic['Profiles.Register']['required']; |
86
|
|
|
}; |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* @return array |
90
|
|
|
*/ |
91
|
1 |
|
$dic['Profiles.Register.optional'] = function( $dic ) { |
92
|
5 |
|
return $dic['Profiles.Register']['optional']; |
93
|
|
|
}; |
94
|
|
|
|
95
|
|
|
|
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* @return StdClass |
99
|
|
|
*/ |
100
|
1 |
|
$dic['Profiles.Signup'] = function( $dic ) { |
101
|
5 |
|
return $dic['Profiles.Config']['signup']; |
102
|
|
|
}; |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @return array |
106
|
|
|
*/ |
107
|
1 |
|
$dic['Profiles.Signup.required'] = function( $dic ) { |
108
|
5 |
|
return $dic['Profiles.Signup']['required']; |
109
|
|
|
}; |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* @return array |
113
|
|
|
*/ |
114
|
1 |
|
$dic['Profiles.Signup.optional'] = function( $dic ) { |
115
|
5 |
|
return $dic['Profiles.Signup']['optional']; |
116
|
|
|
}; |
117
|
|
|
|
118
|
|
|
|
119
|
|
|
|
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* @return StdClass |
123
|
|
|
*/ |
124
|
1 |
|
$dic['Profiles.ChangePassword'] = function( $dic ) { |
125
|
5 |
|
return $dic['Profiles.Config']['change_password']; |
126
|
|
|
}; |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* @return array |
130
|
|
|
*/ |
131
|
1 |
|
$dic['Profiles.ChangePassword.required'] = function( $dic ) { |
132
|
5 |
|
return $dic['Profiles.ChangePassword']['required']; |
133
|
|
|
}; |
134
|
|
|
/** |
135
|
|
|
* @return array |
136
|
|
|
*/ |
137
|
1 |
|
$dic['Profiles.ChangePassword.optional'] = function( $dic ) { |
138
|
5 |
|
return $dic['Profiles.ChangePassword']['optional']; |
139
|
|
|
}; |
140
|
|
|
|
141
|
|
|
|
142
|
|
|
|
143
|
|
|
|
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* @return StdClass |
147
|
|
|
*/ |
148
|
1 |
|
$dic['Profiles.EditProfile'] = function( $dic ) { |
149
|
5 |
|
return $dic['Profiles.Config']['edit_profile']; |
150
|
|
|
}; |
151
|
|
|
|
152
|
|
|
/** |
153
|
|
|
* @return array |
154
|
|
|
*/ |
155
|
1 |
|
$dic['Profiles.EditProfile.required'] = function( $dic ) { |
156
|
5 |
|
return $dic['Profiles.EditProfile']['required']; |
157
|
|
|
}; |
158
|
|
|
|
159
|
|
|
/** |
160
|
|
|
* @return array |
161
|
|
|
*/ |
162
|
2 |
|
$dic['Profiles.EditProfile.optional'] = function( $dic ) { |
163
|
5 |
|
return $dic['Profiles.EditProfile']['optional']; |
164
|
|
|
}; |
165
|
|
|
|
166
|
5 |
|
} |
167
|
|
|
|
168
|
|
|
} |
169
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.