1 | <?php |
||
10 | class OpauthIdentity extends DataObject { |
||
|
|||
11 | |||
12 | private static |
||
13 | $db = array( |
||
14 | 'UID' => 'Varchar(255)', |
||
15 | 'Provider' => 'Varchar(45)', |
||
16 | ), |
||
17 | $has_one = array( |
||
18 | 'Member' => 'Member', |
||
19 | ), |
||
20 | $summary_fields = array( |
||
21 | 'Member.Email' => 'MemberEmail', |
||
22 | 'Provider' => 'Provider', |
||
23 | 'UID' => 'UID', |
||
24 | ); |
||
25 | |||
26 | protected |
||
27 | /** |
||
28 | * @var array source from Opauth |
||
29 | */ |
||
30 | $authSource, |
||
31 | /** |
||
32 | * @var array The parsed member record, if any |
||
33 | */ |
||
34 | $parsedRecord; |
||
35 | |||
36 | private |
||
37 | /** |
||
38 | * @var boolean shim for onBeforeCreate |
||
39 | */ |
||
40 | $_isCreating = false; |
||
41 | |||
42 | /** |
||
43 | * factory |
||
44 | * Returns or creates a fresh OpauthIdentity. |
||
45 | * @param array $oaResponse The response object from Opauth. |
||
46 | * @return OpauthIdentity instance based on $oaResponse. |
||
47 | */ |
||
48 | public static function factory(array $oaResponse) { |
||
75 | |||
76 | /** |
||
77 | * Add an extension point for creation and member linking |
||
78 | */ |
||
79 | public function onBeforeWrite() { |
||
89 | |||
90 | /** |
||
91 | * Add an extension point for afterCreate |
||
92 | */ |
||
93 | public function onAfterWrite() { |
||
100 | |||
101 | /** |
||
102 | * Finds a member based on this identity. Searches existing records before |
||
103 | * creating a new Member object. |
||
104 | * Note that this method does not write anything, merely sets everything up. |
||
105 | * @param array $usrSettings A map of settings because there are so many. |
||
106 | * @return Member |
||
107 | */ |
||
108 | public function findOrCreateMember($usrSettings = array()) { |
||
183 | |||
184 | /** |
||
185 | * @param array $auth |
||
186 | */ |
||
187 | public function setAuthSource($auth) { |
||
192 | |||
193 | /** |
||
194 | * @return array |
||
195 | */ |
||
196 | public function getAuthSource() { |
||
199 | |||
200 | /** |
||
201 | * @return array The mapping arrangement from auth response to Member. |
||
202 | */ |
||
203 | public function getMemberMapper() { |
||
210 | |||
211 | /** |
||
212 | * Use dot notation and/or a parser to retrieve information from a provider. |
||
213 | * Examples of simple dot notation: |
||
214 | * - 'FirstName' => 'info.first_name' |
||
215 | * - 'Surname' => 'info.surname' |
||
216 | * Examples of a parser, for example when only a "name" param is present: |
||
217 | * - 'FirstName' => array('OpauthResponseHelper', 'get_first_name') |
||
218 | * - 'Surname' => array('OpauthResponseHelper', 'get_last_name') |
||
219 | * @see OpauthResponseHelper |
||
220 | * @return array The data record to add to a member |
||
221 | */ |
||
222 | public function getMemberRecordFromAuth() { |
||
237 | |||
238 | } |
||
239 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.