| Conditions | 4 | 
| Paths | 9 | 
| Total Lines | 23 | 
| Code Lines | 14 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 2 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php  | 
            ||
| 15 | function consentSimpleAdmin_hook_sanitycheck(array &$hookinfo): void  | 
            ||
| 16 | { | 
            ||
| 17 | Assert::keyExists($hookinfo, 'errors');  | 
            ||
| 18 | Assert::keyExists($hookinfo, 'info');  | 
            ||
| 19 | |||
| 20 |     try { | 
            ||
| 21 |         $consentconfig = Configuration::getConfig('module_consentSimpleAdmin.php'); | 
            ||
| 22 | |||
| 23 | // Parse consent config  | 
            ||
| 24 |         $consent_storage = Store::parseStoreConfig($consentconfig->getValue('store')); | 
            ||
| 25 | |||
| 26 |         if (!is_callable([$consent_storage, 'selftest'])) { | 
            ||
| 27 | // Doesn't support a selftest  | 
            ||
| 28 | return;  | 
            ||
| 29 | }  | 
            ||
| 30 | $testres = $consent_storage->selftest();  | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 31 |         if ($testres) { | 
            ||
| 32 | $hookinfo['info'][] = '[consentSimpleAdmin] Consent Storage selftest OK.';  | 
            ||
| 33 |         } else { | 
            ||
| 34 | $hookinfo['errors'][] = '[consentSimpleAdmin] Consent Storage selftest failed.';  | 
            ||
| 35 | }  | 
            ||
| 36 |     } catch (Exception $e) { | 
            ||
| 37 | $hookinfo['errors'][] = '[consentSimpleAdmin] Error connecting to storage: ' . $e->getMessage();  | 
            ||
| 38 | }  | 
            ||
| 40 |