ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilTermsOfServiceTableDataProviderFactory Class Reference

Class ilTermsOfServiceTableDataProviderFactory. More...

+ Collaboration diagram for ilTermsOfServiceTableDataProviderFactory:

Public Member Functions

 getByContext (string $context)
 
 setDatabaseAdapter (?ilDBInterface $db)
 
 getDatabaseAdapter ()
 

Data Fields

const CONTEXT_ACCEPTANCE_HISTORY = 'acceptance_history'
 
const CONTEXT_DOCUMENTS = 'documents'
 

Protected Member Functions

 validateConfiguration (array $mandatoryMemberVariables)
 
 getExceptionByMember (string $member)
 

Protected Attributes

ilDBInterface $db = null
 

Detailed Description

Member Function Documentation

◆ getByContext()

ilTermsOfServiceTableDataProviderFactory::getByContext ( string  $context)
Parameters
string$context
Returns
ilTermsOfServiceTableDataProvider
Exceptions
ilTermsOfServiceMissingDatabaseAdapterException
InvalidArgumentException

Definition at line 38 of file class.ilTermsOfServiceTableDataProviderFactory.php.

References getDatabaseAdapter(), and validateConfiguration().

Referenced by ilTermsOfServiceTableDataProviderFactoryTest\testExceptionIsRaisedWhenAcceptanceHistoryProviderIsRequestedWithoutCompleteFactoryConfiguration(), ilTermsOfServiceTableDataProviderFactoryTest\testExceptionIsRaisedWhenUnsupportedProviderIsRequested(), and ilTermsOfServiceTableDataProviderFactoryTest\testFactoryShouldReturnAcceptanceHistoryProviderWhenRequested().

39  {
40  switch ($context) {
41  case self::CONTEXT_ACCEPTANCE_HISTORY:
42  $this->validateConfiguration(['db']);
44 
45  case self::CONTEXT_DOCUMENTS:
47 
48  default:
49  throw new InvalidArgumentException('Provider not supported');
50  }
51  }
$context
Definition: webdav.php:29
Interface ilTermsOfServiceTableDataProvider.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDatabaseAdapter()

ilTermsOfServiceTableDataProviderFactory::getDatabaseAdapter ( )

◆ getExceptionByMember()

ilTermsOfServiceTableDataProviderFactory::getExceptionByMember ( string  $member)
protected
Parameters
string$member
Returns
ilTermsOfServiceException
Exceptions
InvalidArgumentException

Definition at line 72 of file class.ilTermsOfServiceTableDataProviderFactory.php.

Referenced by validateConfiguration().

73  {
74  switch ($member) {
75  case 'db':
77  'Incomplete factory configuration. Please inject a database adapter.'
78  );
79 
80  default:
81  throw new InvalidArgumentException("Exception for member $member not supported");
82  }
83  }
Class ilTermsOfServiceMissingDatabaseAdapterException.
+ Here is the caller graph for this function:

◆ setDatabaseAdapter()

◆ validateConfiguration()

ilTermsOfServiceTableDataProviderFactory::validateConfiguration ( array  $mandatoryMemberVariables)
protected
Parameters
array$mandatoryMemberVariables
Exceptions
ilTermsOfServiceMissingDatabaseAdapterException

Definition at line 57 of file class.ilTermsOfServiceTableDataProviderFactory.php.

References getExceptionByMember().

Referenced by getByContext().

57  : void
58  {
59  foreach ($mandatoryMemberVariables as $member) {
60  if (null === $this->{$member}) {
61  $exception = $this->getExceptionByMember($member);
62  throw $exception;
63  }
64  }
65  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilDBInterface ilTermsOfServiceTableDataProviderFactory::$db = null
protected

◆ CONTEXT_ACCEPTANCE_HISTORY

◆ CONTEXT_DOCUMENTS

const ilTermsOfServiceTableDataProviderFactory::CONTEXT_DOCUMENTS = 'documents'

The documentation for this class was generated from the following file: