ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilTermsOfServiceTableDataProviderFactory Class Reference

Class ilTermsOfServiceTableDataProviderFactory. More...

+ Collaboration diagram for ilTermsOfServiceTableDataProviderFactory:

Public Member Functions

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

Data Fields

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

Protected Member Functions

 validateConfiguration (array $mandatoryMemberVariables)
 
 getExceptionByMember ($member)
 

Protected Attributes

 $db
 

Detailed Description

Member Function Documentation

◆ getByContext()

ilTermsOfServiceTableDataProviderFactory::getByContext ( string  $context)
Parameters
string$context
Returns
Exceptions

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

References getDatabaseAdapter(), and validateConfiguration().

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

23  {
24  switch ($context) {
25  case self::CONTEXT_ACCEPTANCE_HISTORY:
26  $this->validateConfiguration(array('db'));
27  return new \ilTermsOfServiceAcceptanceHistoryProvider($this->getDatabaseAdapter());
28 
29  case self::CONTEXT_DOCUMENTS:
30  return new \ilTermsOfServiceDocumentTableDataProvider();
31 
32  default:
33  throw new \InvalidArgumentException('Provider not supported');
34  }
35  }
$context
Definition: webdav.php:25
Interface ilTermsOfServiceTableDataProvider.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDatabaseAdapter()

ilTermsOfServiceTableDataProviderFactory::getDatabaseAdapter ( )

◆ getExceptionByMember()

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

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

Referenced by validateConfiguration().

57  {
58  switch ($member) {
59  case 'db':
60  return new \ilTermsOfServiceMissingDatabaseAdapterException(
61  'Incomplete factory configuration. Please inject a database adapter.'
62  );
63 
64  default:
65  throw new \InvalidArgumentException("Exception for member {$member} not supported");
66  }
67  }
+ Here is the caller graph for this function:

◆ setDatabaseAdapter()

◆ validateConfiguration()

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

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

References getExceptionByMember().

Referenced by getByContext().

42  {
43  foreach ($mandatoryMemberVariables as $member) {
44  if (null == $this->{$member}) {
45  $exception = $this->getExceptionByMember($member);
46  throw $exception;
47  }
48  }
49  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilTermsOfServiceTableDataProviderFactory::$db
protected

◆ CONTEXT_ACCEPTANCE_HISTORY

◆ CONTEXT_DOCUMENTS

const ilTermsOfServiceTableDataProviderFactory::CONTEXT_DOCUMENTS = 'documents'

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