ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\Event Namespace Reference

Namespaces

namespace  Loop
 
namespace  Promise
 

Data Structures

class  ContinueCallbackTest
 
class  CoroutineTest
 
class  EventEmitter
 EventEmitter object. More...
 
interface  EventEmitterInterface
 Event Emitter Interface. More...
 
class  EventEmitterTest
 
class  Promise
 An implementation of the Promise pattern. More...
 
class  PromiseAlreadyResolvedException
 This exception is thrown when the user tried to reject or fulfill a promise, after either of these actions were already performed. More...
 
class  PromiseTest
 
class  Version
 This class contains the version number for this package. More...
 

Functions

 coroutine (callable $gen)
 Turn asynchronous promise-based code into something that looks synchronous again, through the use of generators. More...
 
 on ($eventName, callable $callBack, $priority=100)
 Subscribe to an event. More...
 
 once ($eventName, callable $callBack, $priority=100)
 Subscribe to an event exactly once. More...
 
 emit ($eventName, array $arguments=[], callable $continueCallBack=null)
 Emits an event. More...
 
 listeners ($eventName)
 Returns the list of listeners for an event. More...
 
 removeListener ($eventName, callable $listener)
 Removes a specific listener from an event. More...
 
 removeAllListeners ($eventName=null)
 Removes all listeners. More...
 

Variables

trait EventEmitterTrait
 Event Emitter Trait. More...
 

Function Documentation

◆ coroutine()

Sabre\Event\coroutine ( callable  $gen)

Turn asynchronous promise-based code into something that looks synchronous again, through the use of generators.

Example without coroutines:

$promise = $httpClient->request('GET', '/foo'); $promise->then(function($value) {

return $httpClient->request('DELETE','/foo');

})->then(function($value) {

return $httpClient->request('PUT', '/foo');

})->error(function($reason) {

echo "Failed because: $reason\n";

});

Example with coroutines:

coroutine(function() {

try { yield $httpClient->request('GET', '/foo'); yield $httpClient->request('DELETE', /foo'); yield $httpClient->request('PUT', '/foo'); } catch(\Exception $reason) { echo "Failed because: $reason\n"; }

});

Author
Evert Pot (http://evertpot.com/) @license http://sabre.io/license/ Modified BSD License

So tempted to use the mythical y-combinator here, but it's not needed in PHP.

Definition at line 47 of file coroutine.php.

47 {
48
49 $generator = $gen();
50 if (!$generator instanceof Generator) {
51 throw new \InvalidArgumentException('You must pass a generator function');
52 }
53
54 // This is the value we're returning.
55 $promise = new Promise();
56
57 $lastYieldResult = null;
58
63 $advanceGenerator = function() use (&$advanceGenerator, $generator, $promise, &$lastYieldResult) {
64
65 while ($generator->valid()) {
66
67 $yieldedValue = $generator->current();
68 if ($yieldedValue instanceof Promise) {
69 $yieldedValue->then(
70 function($value) use ($generator, &$advanceGenerator, &$lastYieldResult) {
71 $lastYieldResult = $value;
72 $generator->send($value);
73 $advanceGenerator();
74 },
75 function($reason) use ($generator, $advanceGenerator) {
76 if ($reason instanceof Exception) {
77 $generator->throw($reason);
78 } elseif (is_scalar($reason)) {
79 $generator->throw(new Exception($reason));
80 } else {
81 $type = is_object($reason) ? get_class($reason) : gettype($reason);
82 $generator->throw(new Exception('Promise was rejected with reason of type: ' . $type));
83 }
84 $advanceGenerator();
85 }
86 )->error(function($reason) use ($promise) {
87 // This error handler would be called, if something in the
88 // generator throws an exception, and it's not caught
89 // locally.
90 $promise->reject($reason);
91 });
92 // We need to break out of the loop, because $advanceGenerator
93 // will be called asynchronously when the promise has a result.
94 break;
95 } else {
96 // If the value was not a promise, we'll just let it pass through.
97 $lastYieldResult = $yieldedValue;
98 $generator->send($yieldedValue);
99 }
100
101 }
102
103 // If the generator is at the end, and we didn't run into an exception,
104 // we can fullfill the promise with the last thing that was yielded to
105 // us.
106 if (!$generator->valid() && $promise->state === Promise::PENDING) {
107 $promise->fulfill($lastYieldResult);
108 }
109
110 };
111
112 try {
113 $advanceGenerator();
114 } catch (Exception $e) {
115 $promise->reject($e);
116 }
117
118 return $promise;
119
120}
error($a_errmsg)
set error message @access public
$promise
This example shows demonstrates the Promise api.
Definition: promise.php:16
$type

References $promise, $type, error(), and Sabre\Event\Promise\PENDING.

Referenced by Sabre\Event\CoroutineTest\testBasicCoroutine(), Sabre\Event\CoroutineTest\testCoroutineException(), Sabre\Event\CoroutineTest\testDeepException(), Sabre\Event\CoroutineTest\testFulfilledPromise(), Sabre\Event\CoroutineTest\testFulfilledPromiseAsync(), Sabre\Event\CoroutineTest\testNonGenerator(), Sabre\Event\CoroutineTest\testRejectedPromise(), Sabre\Event\CoroutineTest\testRejectedPromiseArray(), Sabre\Event\CoroutineTest\testRejectedPromiseAsync(), Sabre\Event\CoroutineTest\testRejectedPromiseException(), Sabre\Event\CoroutineTest\testResolveToLastYield(), and Sabre\Event\CoroutineTest\testResolveToLastYieldPromise().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ emit()

Sabre\Event\emit (   $eventName,
array  $arguments = [],
callable  $continueCallBack = null 
)

Emits an event.

This method will return true if 0 or more listeners were succesfully handled. false is returned if one of the events broke the event chain.

If the continueCallBack is specified, this callback will be called every time before the next event handler is called.

If the continueCallback returns false, event propagation stops. This allows you to use the eventEmitter as a means for listeners to implement functionality in your application, and break the event loop as soon as some condition is fulfilled.

Note that returning false from an event subscriber breaks propagation and returns false, but if the continue-callback stops propagation, this is still considered a 'successful' operation and returns true.

Lastly, if there are 5 event handlers for an event. The continueCallback will be called at most 4 times.

Parameters
string$eventName
array$arguments
callback$continueCallBack
Returns
bool

Definition at line 99 of file EventEmitterTrait.php.

99 {
100
101 if (is_null($continueCallBack)) {
102
103 foreach ($this->listeners($eventName) as $listener) {
104
105 $result = call_user_func_array($listener, $arguments);
106 if ($result === false) {
107 return false;
108 }
109 }
110
111 } else {
112
113 $listeners = $this->listeners($eventName);
114 $counter = count($listeners);
115
116 foreach ($listeners as $listener) {
117
118 $counter--;
119 $result = call_user_func_array($listener, $arguments);
120 if ($result === false) {
121 return false;
122 }
123
124 if ($counter > 0) {
125 if (!$continueCallBack()) break;
126 }
127
128 }
129
130 }
131
132 return true;
133
134 }
$result
listeners($eventName)
Returns the list of listeners for an event.

References $result, and Sabre\Event\listeners().

+ Here is the call graph for this function:

◆ listeners()

Sabre\Event\listeners (   $eventName)

Returns the list of listeners for an event.

The list is returned as an array, and the list of events are sorted by their priority.

Parameters
string$eventName
Returns
callable[]

Definition at line 145 of file EventEmitterTrait.php.

145 {
146
147 if (!isset($this->listeners[$eventName])) {
148 return [];
149 }
150
151 // The list is not sorted
152 if (!$this->listeners[$eventName][0]) {
153
154 // Sorting
155 array_multisort($this->listeners[$eventName][1], SORT_NUMERIC, $this->listeners[$eventName][2]);
156
157 // Marking the listeners as sorted
158 $this->listeners[$eventName][0] = true;
159 }
160
161 return $this->listeners[$eventName][2];
162
163 }

References Sabre\Event\listeners().

Referenced by Sabre\Event\emit(), Sabre\Event\listeners(), Sabre\Event\on(), Sabre\Event\removeAllListeners(), and Sabre\Event\removeListener().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ on()

Sabre\Event\on (   $eventName,
callable  $callBack,
  $priority = 100 
)

Subscribe to an event.

Parameters
string$eventName
callable$callBack
int$priority
Returns
void

Definition at line 35 of file EventEmitterTrait.php.

35 {
36
37 if (!isset($this->listeners[$eventName])) {
38 $this->listeners[$eventName] = [
39 true, // If there's only one item, it's sorted
40 [$priority],
41 [$callBack]
42 ];
43 } else {
44 $this->listeners[$eventName][0] = false; // marked as unsorted
45 $this->listeners[$eventName][1][] = $priority;
46 $this->listeners[$eventName][2][] = $callBack;
47 }
48
49 }

References Sabre\Event\listeners().

Referenced by ilExternalFeed\_getRSSLocation(), Sabre\Event\once(), showHelp(), ilWACTokenTest\testCookieGeneration(), and Sabre\VObject\Parser\XmlTest\testRFC6321Example2().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ once()

Sabre\Event\once (   $eventName,
callable  $callBack,
  $priority = 100 
)

Subscribe to an event exactly once.

Parameters
string$eventName
callable$callBack
int$priority
Returns
void

Definition at line 59 of file EventEmitterTrait.php.

59 {
60
61 $wrapper = null;
62 $wrapper = function() use ($eventName, $callBack, &$wrapper) {
63
64 $this->removeListener($eventName, $wrapper);
65 return call_user_func_array($callBack, func_get_args());
66
67 };
68
69 $this->on($eventName, $wrapper, $priority);
70
71 }
removeListener($eventName, callable $listener)
Removes a specific listener from an event.
on($eventName, callable $callBack, $priority=100)
Subscribe to an event.

References Sabre\Event\on(), and Sabre\Event\removeListener().

Referenced by ilChatroomAbstractTaskTest\createSendResponseMock(), assClozeTestGUITest\setUp(), assFlashQuestionGUITest\setUp(), assImagemapQuestionGUITest\setUp(), ComponentRendererLoaderCachingWrapperTest\test_caches(), ilObjChatroomAccessTest\test_checkAccessReturnFalse(), ilObjChatroomAccessTest\test_checkAccessReturnTrueWithRbacAccess(), ilObjChatroomAccessTest\test_checkGotoReturnTrue(), ilObjChatroomAdminAccessTest\test_checkGotoReturnTrue(), ComponentRendererLoaderCachingWrapperTest\test_forwards_from_underlying(), ComponentRendererLoaderResourceRegistryWrapperTest\test_forwards_from_underlying(), ilObjChatroomTest\test_GetPublicObjId(), ilObjChatroomTest\test_GetPublicObjIdDefaultValue(), ComponentRendererFSLoaderTest\test_getRenderer_successfully_extra(), ComponentRendererFSLoaderTest\test_getRenderer_uses_RendererFactory(), ValidationConstraintsCustomTest\test_gracefully_handle_arrays_and_objects(), ValidationConstraintsCustomTest\test_no_sprintf_on_one_parameter(), DefaultRendererTest\test_passesContextsToComponentRendererLoader(), ComponentRendererLoaderResourceRegistryWrapperTest\test_registerResources(), ValidationConstraintsCustomTest\test_use_txt(), ilIndividualAssessmentMembersTest\test_withAccessHandling(), ilCertificateTemplatePreviewActionTest\testA(), ilFormFieldParserTest\testA4Landscape(), ilFormFieldParserTest\testA5(), ilFormFieldParserTest\testA5Landscape(), ilTermsOfServiceHelperTest\testAcceptanceHistoryCanBeDeleted(), ilTermsOfServiceAppEventListenerTest\testAcceptanceHistoryDeletionIsDelegatedWhenUserIsDeleted(), ilTermsOfServiceAcceptanceDatabaseGatewayTest\testAcceptanceHistoryOfAUserCanBeDeleted(), ilTermsOfServiceAcceptanceDatabaseGatewayTest\testAcceptanceHistoryRecordCanBeLoadedById(), ilTermsOfServiceAcceptanceDatabaseGatewayTest\testAcceptanceIsTrackedAndCreatesANewTermsOfServicesVersionIfNecessary(), ilTermsOfServiceAcceptanceDatabaseGatewayTest\testAcceptanceIsTrackedAndRefersToAnExistingTermsOfServicesVersion(), ilTermsOfServiceDocumentGUITest\testAccessDeniedErrorIsRaisedWhenPermissionsAreMissing(), Sabre\DAV\ServerEventsTest\testAfterResponse(), Twig_Tests_EnvironmentTest\testAutoReloadCacheHit(), Twig_Tests_EnvironmentTest\testAutoReloadCacheMiss(), Twig_Tests_EnvironmentTest\testAutoReloadOutdatedCacheHit(), Monolog\LoggerTest\testBubblingWhenTheHandlerReturnsFalse(), ilChatroomUserTest\testBuildFullname(), ilChatroomUserTest\testBuildLogin(), ilChatroomUserTest\testBuildShortname(), ilMailAddressTypesTest\testCacheOnlyResolvesAndValidatesRecipientsOnceIfCachingIsEnabled(), ilCertificateTemplateImportActionTest\testCertificateCanBeImportedWithBackgroundImage(), ilCertificateTemplateImportActionTest\testCertificateCanBeImportedWithoutBackgroundImage(), ilCertificateCloneActionTest\testCloneCertificate(), ilMailOptionsTest\testConstructor(), ilCertificateSettingsExerciseRepositoryTest\testCreate(), ilCertificateSettingsTestFormRepositoryTest\testCreate(), ilTermsOfServiceDocumentTest\testCriteriaCanBeAttachedToAndDetachedFromDocumentPersistently(), ilFormFieldParserTest\testCustomPageWidth(), Monolog\Handler\GelfHandlerTest\testDebug(), Monolog\Handler\PHPConsoleHandlerTest\testDebug(), Monolog\Handler\PHPConsoleHandlerTest\testDebugContextInMessage(), Monolog\Handler\PHPConsoleHandlerTest\testDebugTags(), ilMailTemplateServiceTest\testDefaultTemplateCanBeSetByContext(), ilMailTemplateServiceTest\testDefaultTemplateForContextCanBeUnset(), ilCertificateTestTemplateDeleteActionTest\testDelete(), ilCertificateScormTemplateDeleteActionTest\testDeleteScormTemplateAndSettings(), ilCertificateTemplateDeleteActionTest\testDeleteTemplateAndUseOldThumbnail(), ilCertificateTemplateDeleteActionTest\testDeleteTemplateButNoThumbnailWillBeCopiedFromOldCertificate(), Twig_Tests_Extension_DateTest\testDiffCanReturnTranslatableString(), ilTermsOfServiceHelperTest\testDocumentCanBeAccepted(), ilTermsOfServiceDocumentTest\testDocumentModelCanBeBuiltFromArrayWithAttachedCriteriaBeingRead(), ilTermsOfServiceDocumentTest\testDocumentModelCanCreatedByIdWithAttachedCriteriaBeingRead(), ilCertificatePdfActionTest\testDownloadResultsInExceptionBecauseTheServerIsNotActive(), ilMailTemplateRepositoryTest\testEntityCanBeDeleted(), ilMailTemplateRepositoryTest\testEntityCanBeModified(), ilMailTemplateRepositoryTest\testEntityCanBeSaved(), ilCertificateQueueRepositoryTest\testEntryCanBeAddedToQueue(), Monolog\Handler\PHPConsoleHandlerTest\testError(), ilTermsOfServiceUserHasGlobalRoleCriterionTest\testEvaluationFailsIfConfiguredRoleIsNotAGlobalRole(), ilTermsOfServiceUserHasGlobalRoleCriterionTest\testEvaluationFailsIfUserIsNotAssignedToConfiguredGlobalRole(), ilTermsOfServiceUserHasGlobalRoleCriterionTest\testEvaluationSucceedsIfUserIsAssignedToDefinedGlobalRole(), Monolog\Handler\PHPConsoleHandlerTest\testException(), ilMailTemplateRepositoryTest\testExceptionIsRaisedIfNoTemplateCanBeFoundById(), Monolog\Handler\SocketHandlerTest\testExceptionIsThrownIfCannotSetChunkSize(), Monolog\Handler\SocketHandlerTest\testExceptionIsThrownIfCannotSetTimeout(), Monolog\Handler\SocketHandlerTest\testExceptionIsThrownOnFsockopenError(), Monolog\Handler\SocketHandlerTest\testExceptionIsThrownOnPfsockopenError(), ilStopWorkflowActivityTest\testExecute(), ilChatroomClearTaskTest\testExecuteDefault(), ilChatroomClearTaskTest\testExecuteDefaultFailedNoRoomExists(), ilChatroomClearTaskTest\testExecuteDefaultFailedPermission(), Twig_Tests_Loader_ChainTest\testExists(), ilCertificateTemplateExportActionTest\testExport(), ilCertificateQueueRepositoryTest\testFetchAllEntriesFromQueue(), ilCertificateSettingsScormFormRepositoryTest\testFetchFormFieldData(), ilUserCertificateTableProviderTest\testFetchingDataSetForTableWithoutParamtersAndWithoutFilters(), ilUserCertificateRepositoryTest\testFetchObjectWithCertificateForUser(), ilUserCertificateRepositoryTest\testFetchUserIdsWithCertificateForObject(), ilCertificateBackgroundImageUploadTest\testFileCanBeUploaded(), ilTermsOfServiceSettingsFormGUITest\testFormCanBeSavedWithDisabledService(), ilTermsOfServiceSettingsFormGUITest\testFormCanBeSavedWithEnabledServiceWhenAtLeastOneDocumentExists(), ilTermsOfServiceSettingsFormGUITest\testFormCanBeSavedWithEnabledServiceWhenNoDocumentsExistButServiceIsAlreadyEnabled(), ilTermsOfServiceSettingsFormGUITest\testFormCannotBeSavedWithEnabledServiceWhenNoDocumentsExistAndServiceIsCurrentlyDisabled(), ilCertificateSettingsExerciseRepositoryTest\testFormFieldData(), ilCertificateSettingsTestFormRepositoryTest\testFormFieldData(), ilTermsOfServiceCriterionFormGUITest\testFormForExistingAssignmentCannotBeSavedForInalidInput(), ilTermsOfServiceDocumentFormGUITest\testFormForExistingDocumentsCanBeSavedForValidInput(), ilTermsOfServiceCriterionFormGUITest\testFormForNewCriterionAssignmentCanBeSavedForValidInput(), ilTermsOfServiceDocumentFormGUITest\testFormForNewDocumentsCanBeSavedForValidInput(), ilTermsOfServiceCriterionFormGUITest\testFormIsProperlyBuiltForExistingCriterionAssignment(), ilTermsOfServiceCriterionFormGUITest\testFormIsProperlyBuiltForNewCriterionAssignment(), ilChatroomUserTest\testGetChatNameSuggestionsIfNotAnonymous(), Monolog\Handler\HandlerWrapperTest\testGetFormatter(), ilCertificateLearningHistoryProviderTest\testGetName(), ilObjChatroomTest\testGetPersonalInformation(), ilDefaultPlaceholderValuesTest\testGetPlaceholderValues(), ilExercisePlaceholderValuesTest\testGetPlaceholderValues(), ilScormPlaceholderValuesTest\testGetPlaceholderValues(), ilChatroomUserTest\testGetUserIdFromSessionIfAnonymous(), ilChatroomUserTest\testGetUserIdIfNotAnonymous(), ilChatroomUserTest\testGetUserIdRandomGeneratedIfAnonymous(), ilChatroomUserTest\testGetUsernameFromIlObjUser(), Monolog\Handler\HandlerWrapperTest\testHandle(), Monolog\Handler\DoctrineCouchDBHandlerTest\testHandle(), Monolog\Handler\DynamoDbHandlerTest\testHandle(), Monolog\Handler\MailHandlerTest\testHandle(), Monolog\Handler\MongoDBHandlerTest\testHandle(), Monolog\Handler\AmqpHandlerTest\testHandleAmqpExt(), Monolog\Handler\HandlerWrapperTest\testHandleBatch(), Monolog\Handler\MailHandlerTest\testHandleBatch(), Monolog\Handler\RavenHandlerTest\testHandleBatch(), Monolog\Handler\RavenHandlerTest\testHandleBatchPicksProperMessage(), Monolog\LoggerTest\testHandlersNotCalledBeforeFirstHandling(), Monolog\LoggerTest\testHandlersNotCalledBeforeFirstHandlingWithAssocArray(), Monolog\Handler\PsrHandlerTest\testHandlesAllLevels(), ilObjChatroomTest\testInitDefaultRoles(), Monolog\Handler\GelfHandlerTest\testInjectedGelfMessageFormatter(), ilBuddyListTest\testInstanceCanBeCreatedByGlobalUserObject(), ilBuddyListTest\testInstanceCannotBeCreatedByAnonymousGlobalUserObject(), Monolog\Handler\HandlerWrapperTest\testIsHandling(), ilTermsOfServiceDocumentGUITest\testLastResetDateIsDisplayedInMessageBoxWhenAgreementsHaveBeenResetAtLeastOnce(), ilTermsOfServiceAcceptanceDatabaseGatewayTest\testLatestAcceptanceOfUserCanBeLoaded(), ilFormFieldParserTest\testLetter(), ilFormFieldParserTest\testLetterLandscape(), ilTermsOfServiceDocumentTableDataProviderTest\testListOfDocumentsCanBeRetrieved(), Twig_Tests_ContainerRuntimeLoaderTest\testLoad(), ValidationFactoryTest\testLoadsLanguageModule(), Twig_Tests_ContainerRuntimeLoaderTest\testLoadUnknownRuntimeReturnsNull(), Monolog\LoggerTest\testLog(), ilTermsOfServiceDocumentCriteriaEvaluationTest\testLogicalAndEvaluatorReturnsFalseIfAnyCriteriaAttachedToADocumentDoesNotMatch(), ilTermsOfServiceDocumentCriteriaEvaluationTest\testLogicalAndEvaluatorReturnsTrueIfAllCriteriaAttachedToADocumentMatch(), ilTermsOfServiceDocumentCriteriaEvaluationTest\testLogicalAndEvaluatorReturnsTrueIfNoCriterionIsAttachedToADocumentAtAll(), ilMailOptionsGUITest\testMailOptionsAreNotAccessibleIfGlobalAccessIsDeniedAndUserWillBeRedirectedToMailSystem(), ilMailOptionsGUITest\testMailOptionsAreNotAccessibleIfGlobalAccessIsDeniedAndUserWillBeRedirectedToPersonalSettings(), Monolog\Handler\SwiftMailerHandlerTest\testMessageCanBeCustomizedGivenLoggedData(), Monolog\Handler\SwiftMailerHandlerTest\testMessageSubjectFormatting(), ilMailMimeTest\testMimMailDelegatesEmailDeliveryToDefaultTransport(), ilMailMimeTest\testMimMailDelegatesEmailDeliveryToThePassedTransporter(), ilTermsOfServiceDocumentGUITest\testNoLastResetDateIsDisplayedInMessageBoxWhenAgreementsHaveBeenResetAtLeastOnce(), ilMailTransportSettingsTest\testNoMailWillResultInUpdateProcess(), Monolog\LoggerTest\testNotBubblingWhenTheHandlerReturnsTrue(), ilMailAddressTypesTest\testNoUserIdCanBeResolvedFromEmailAddress(), ilMailAddressTypesTest\testNoUserIdCanBeResolvedFromUnknownLoginAddress(), ilMailAddressTypesTest\testNoUserIdsCanBeResolvedFromInvalidRoleAddress(), ilCertificateTemplateImportActionTest\testNoXmlFileInUplodadZipFolder(), Psr\Log\Test\LoggerInterfaceTest\testObjectCastToString(), ilMailTransportSettingsTest\testOnlyFirstMailWillResultInUpdateProcess(), ilMailTransportSettingsTest\testOnlySecondMailWillResultInUpdateProcess(), Monolog\Handler\PHPConsoleHandlerTest\testOptionCallsConnectorMethod(), ilObjUserPasswordTest\testPasswordManagerEncodesRawPasswordWithoutSalt(), ilObjUserPasswordTest\testPasswordManagerEncodesRawPasswordWithSalt(), ilObjUserPasswordTest\testPasswordManagerMigratesPasswordOnVerificationWithVariantEncoders(), ilObjUserPasswordTest\testPasswordManagerNeverMigratesPasswordOnFailedVerificationWithVariantEncoders(), ilObjUserPasswordTest\testPasswordManagerReencodesPasswordIfReencodingIsNecessary(), ilObjUserPasswordTest\testPasswordManagerVerifiesPassword(), ilMailAddressTypesTest\testPermissionsAreCheckedForRegularUsersWhenValidatingGlobalRoleAddresses(), Monolog\Handler\HandlerWrapperTest\testPopProcessor(), Monolog\Handler\RedisHandlerTest\testPredisHandle(), Monolog\Handler\RedisHandlerTest\testPredisHandleCapped(), GreatherThanConstraintTest\testProblemWith(), HasMaxLengthConstraintTest\testProblemWith(), HasMinLengthConstraintTest\testProblemWith(), IsIntConstraintTest\testProblemWith(), IsNullConstraintTest\testProblemWith(), IsNumericConstraintTest\testProblemWith(), IsStringConstraintTest\testProblemWith(), LessThanConstraintTest\testProblemWith(), NotTest\testProblemWith(), Monolog\LoggerTest\testProcessorsAreCalledOnlyOnce(), Monolog\LoggerTest\testProcessorsNotCalledWhenNotHandled(), Monolog\Handler\AbstractProcessingHandlerTest\testProcessRecord(), Monolog\Handler\HandlerWrapperTest\testPushProcessor(), Monolog\Handler\RedisHandlerTest\testRedisHandle(), Monolog\Handler\RedisHandlerTest\testRedisHandleCapped(), ilBuddyListTest\testRelationCannotBeRequestedForUnknownUserAccounts(), ilBuddyListTest\testRelationRequestCannotBeApprovedByTheRelationOwner(), ilBuddyListTest\testRelationRequestCannotBeIgnoredByTheRelationOwner(), ilCertificateQueueRepositoryTest\testRemoveFromQueue(), ilBuddyListTest\testRepositoryIsEnquiredOnlyOnceToFetchRelationsWhenCalledImplicitly(), ilBuddyListTest\testRepositoryIsEnquiredWhenBuddyListShouldBeDestroyed(), Monolog\Handler\HandlerWrapperTest\testSetFormatter(), ilTermsOfServiceTrimmedDocumentPurifierTest\testSingleStringIsTrimmed(), ilTermsOfServiceAppEventListenerTest\testStaticEventListeningWorksAsExpected(), ilMailTemplateRepositoryTest\testTemplateCanBeFoundById(), ilBuddyListTest\testUnlinkedRelationIsReturnedWhenRelationWasRequestedForAUknownBuddyId(), ilTermsOfServiceDocumentFormGUITest\testUploadIssuesAreHandledWhenDocumentFormIsSaved(), ilMailAddressTypesTest\testUserIdCanBeResolvedFromLoginAddress(), ilMailAddressTypesTest\testUserIdsCanBeResolvedFromGroupNameAddress(), ilMailAddressTypesTest\testUserIdsCanBeResolvedFromRoleAddress(), ilMailAddressTypesTest\testUserIdsCannotBeResolvedFromNonExistingGroupNameAddress(), ilTermsOfServiceRequestTargetAdjustmentCaseTest\testUserShouldBeForcedToAcceptTermsOfServiceWhenNotDoingItYetInCurrentRequest(), ilMailAddressTypesTest\testValidationFailsForNonExistingGroupNameAddress(), ilMailAddressTypesTest\testValidationForAnonymousUserAsSystemActorSucceedsAlwaysForGlobalRoleAddresses(), ilCertificateDownloadValidatorTest\testValidationReturnedFalseBecauseJavaServerIsNotActive(), ilCertificateActiveValidatorTest\testValidationReturnFalseBecauseJavaServerIsInactive(), ilMailAddressTypesTest\testValidationSucceedsForExistingGroupName(), ilTermsOfServiceUserHasGlobalRoleCriterionTest\testValuesFromFormUserInterfaceElementsCanBeRetrieved(), ilTermsOfServiceUserHasLanguageCriterionTest\testValuesFromFormUserInterfaceElementsCanBeRetrieved(), Monolog\Handler\GelfHandlerTest\testWarning(), ilMailAddressParserTest\testWrappingParserDelegatesParsingToAggregatedParser(), Monolog\Handler\ZendMonitorHandlerTest\testWrite(), and ilCertificateTemplateImportActionTest\testZipfileCouldNoBeMoved().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeAllListeners()

Sabre\Event\removeAllListeners (   $eventName = null)

Removes all listeners.

If the eventName argument is specified, all listeners for that event are removed. If it is not specified, every listener for every event is removed.

Parameters
string$eventName
Returns
void

Definition at line 201 of file EventEmitterTrait.php.

201 {
202
203 if (!is_null($eventName)) {
204 unset($this->listeners[$eventName]);
205 } else {
206 $this->listeners = [];
207 }
208
209 }

References Sabre\Event\listeners().

+ Here is the call graph for this function:

◆ removeListener()

Sabre\Event\removeListener (   $eventName,
callable  $listener 
)

Removes a specific listener from an event.

If the listener could not be found, this method will return false. If it was removed it will return true.

Parameters
string$eventName
callable$listener
Returns
bool

Definition at line 175 of file EventEmitterTrait.php.

175 {
176
177 if (!isset($this->listeners[$eventName])) {
178 return false;
179 }
180 foreach ($this->listeners[$eventName][2] as $index => $check) {
181 if ($check === $listener) {
182 unset($this->listeners[$eventName][1][$index]);
183 unset($this->listeners[$eventName][2][$index]);
184 return true;
185 }
186 }
187 return false;
188
189 }
$index
Definition: metadata.php:60

References $index, and Sabre\Event\listeners().

Referenced by Sabre\Event\once().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ EventEmitterTrait

trait Sabre::Event\EventEmitterTrait
Initial value:
{
protected $listeners = []

Event Emitter Trait.

This trait contains all the basic functions to implement an EventEmitterInterface.

Using the trait + interface allows you to add EventEmitter capabilities without having to change your base-class.

Author
Evert Pot (http://evertpot.com/) @license http://sabre.io/license/ Modified BSD License

Definition at line 18 of file EventEmitterTrait.php.