ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilAccessibilityTableDataProviderFactory.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
3
8{
9 const CONTEXT_DOCUMENTS = 'documents';
10
12 protected $db;
13
21 {
22 switch ($context) {
25
26 default:
27 throw new InvalidArgumentException('Provider not supported');
28 }
29 }
30
35 protected function validateConfiguration(array $mandatoryMemberVariables) : void
36 {
37 foreach ($mandatoryMemberVariables as $member) {
38 if (null === $this->{$member}) {
39 $exception = $this->getExceptionByMember($member);
40 throw $exception;
41 }
42 }
43 }
44
50 protected function getExceptionByMember(string $member)
51 {
52 switch ($member) {
53 case 'db':
55 'Incomplete factory configuration. Please inject a database adapter.'
56 );
57
58 default:
59 throw new InvalidArgumentException("Exception for member {$member} not supported");
60 }
61 }
62
67 {
68 $this->db = $db;
69 }
70
74 public function getDatabaseAdapter() : ?ilDBInterface
75 {
76 return $this->db;
77 }
78}
An exception for terminatinating execution or to throw for unit testing.
Interface ilAccessibilityTableDataProvider.
Interface ilDBInterface.
$context
Definition: webdav.php:26