ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilBuddySystemRelationStateFactory Class Reference

Class ilBuddySystemRelationStateFactory. More...

+ Collaboration diagram for ilBuddySystemRelationStateFactory:

Public Member Functions

 __construct (protected ilLanguage $lng)
 
 reset ()
 
 getValidStates ()
 Get all valid states. More...
 
 getInitialState ()
 
 getTableFilterStateMapper (ilBuddySystemRelationState $state)
 
 getStateButtonRendererByOwnerAndRelation (int $ownerId, ilBuddySystemRelation $relation)
 

Static Public Member Functions

static getInstance (?ilLanguage $lng=null)
 

Static Protected Attributes

static self $instance = null
 
static array $validStates = null
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilBuddySystemRelationStateFactory::__construct ( protected ilLanguage  $lng)

Definition at line 31 of file class.ilBuddySystemRelationStateFactory.php.

32 {
33 }

Member Function Documentation

◆ getInitialState()

ilBuddySystemRelationStateFactory::getInitialState ( )
Exceptions
ilBuddySystemException

Definition at line 70 of file class.ilBuddySystemRelationStateFactory.php.

71 {
72 foreach ($this->getValidStates() as $state) {
73 if ($state->isInitial()) {
74 return $state;
75 }
76 }
77
78 throw new ilBuddySystemException('Could not find an initial state class');
79 }
Class ilBuddySystemException.
Interface ilBuddySystemRelationState.

References getValidStates().

+ Here is the call graph for this function:

◆ getInstance()

static ilBuddySystemRelationStateFactory::getInstance ( ?ilLanguage  $lng = null)
static

Definition at line 35 of file class.ilBuddySystemRelationStateFactory.php.

35 : self
36 {
37 global $DIC;
38
39 if (null === self::$instance) {
40 $lng ??= $DIC['lng'];
41
42 self::$instance = new self($lng);
43 }
44
45 return self::$instance;
46 }
global $lng
Definition: privfeed.php:31
global $DIC
Definition: shib_login.php:26

References $DIC, $instance, and $lng.

Referenced by ilBuddySystemGUI\__construct(), ILIAS\Contact\BuddySystem\Tables\RelationsTable\filterComponent(), ilBuddySystemLinkButton\getHtml(), ilBuddyList\getRelationByUserId(), and ilBuddySystemStateFactoryTestCase\setUp().

+ Here is the caller graph for this function:

◆ getStateButtonRendererByOwnerAndRelation()

ilBuddySystemRelationStateFactory::getStateButtonRendererByOwnerAndRelation ( int  $ownerId,
ilBuddySystemRelation  $relation 
)

Definition at line 89 of file class.ilBuddySystemRelationStateFactory.php.

93 $stateClass = $relation->getState()::class;
94 $class = $stateClass . 'ButtonRenderer';
95
96 return new $class($ownerId, $relation);
97 }
$relation

◆ getTableFilterStateMapper()

ilBuddySystemRelationStateFactory::getTableFilterStateMapper ( ilBuddySystemRelationState  $state)

Definition at line 81 of file class.ilBuddySystemRelationStateFactory.php.

82 {
83 $stateClass = $state::class;
84 $class = $stateClass . 'TableFilterMapper';
85
86 return new $class($this->lng, $state);
87 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getValidStates()

ilBuddySystemRelationStateFactory::getValidStates ( )

Get all valid states.

Returns
ilBuddySystemRelationState[]

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

57 : array
58 {
59 return self::$validStates ?? (self::$validStates = [
64 ]);
65 }

Referenced by getInitialState().

+ Here is the caller graph for this function:

◆ reset()

ilBuddySystemRelationStateFactory::reset ( )

Definition at line 48 of file class.ilBuddySystemRelationStateFactory.php.

48 : void
49 {
50 self::$instance = null;
51 }

Field Documentation

◆ $instance

self ilBuddySystemRelationStateFactory::$instance = null
staticprotected

Definition at line 27 of file class.ilBuddySystemRelationStateFactory.php.

Referenced by getInstance().

◆ $validStates

array ilBuddySystemRelationStateFactory::$validStates = null
staticprotected

Definition at line 29 of file class.ilBuddySystemRelationStateFactory.php.


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