/** * Emits a signal when an Advice is invoked * * The advice is not proxyable, so the signal is dispatched manually here. * * @param object $aspectObject * @param string $methodName * @param JoinPointInterface $joinPoint * @return void * @Flow\Signal */ protected function emitAdviceInvoked($aspectObject, $methodName, $joinPoint) { if ($this->dispatcher === null) { $this->dispatcher = $this->objectManager->get(Dispatcher::class); } $this->dispatcher->dispatch(self::class, 'adviceInvoked', [$aspectObject, $methodName, $joinPoint]); }
/** * Emits a signal when package states have been changed (e.g. when a package was created or activated) * * The advice is not proxyable, so the signal is dispatched manually here. * * @return void * @Flow\Signal */ protected function emitPackageStatesUpdated() { if ($this->bootstrap === null) { return; } if ($this->dispatcher === null) { $this->dispatcher = $this->bootstrap->getEarlyInstance(Dispatcher::class); } $this->dispatcher->dispatch(PackageManager::class, 'packageStatesUpdated'); }
/** * Passes the signal over to the Dispatcher * * @Flow\AfterReturning("methodAnnotatedWith(Neos\Flow\Annotations\Signal)") * @param JoinPointInterface $joinPoint The current join point * @return void */ public function forwardSignalToDispatcher(JoinPointInterface $joinPoint) { $signalName = lcfirst(str_replace('emit', '', $joinPoint->getMethodName())); $this->dispatcher->dispatch($joinPoint->getClassName(), $signalName, $joinPoint->getMethodArguments()); }
/** * @test */ public function dispatchPassesArgumentContainingSlotInformationLastIfTheConnectionStatesSo() { $arguments = []; $mockSlot = function () use(&$arguments) { $arguments = func_get_args(); }; $mockObjectManager = $this->createMock(ObjectManagerInterface::class); $dispatcher = new Dispatcher(); $dispatcher->connect('SignalClassName', 'methodName', $mockSlot, null, true); $dispatcher->injectObjectManager($mockObjectManager); $dispatcher->dispatch('SignalClassName', 'methodName', ['foo' => 'bar', 'baz' => 'quux']); $this->assertSame(['bar', 'quux', 'SignalClassName::methodName'], $arguments); }
/** * Signalizes that the specified directory has changed * * @param string $monitorIdentifier Name of the monitor which detected the change * @param array $changedDirectories An array of changed directories (key = path) and their status (value) * @return void * @api */ protected function emitDirectoriesHaveChanged($monitorIdentifier, array $changedDirectories) { $this->signalDispatcher->dispatch(FileMonitor::class, 'directoriesHaveChanged', [$monitorIdentifier, $changedDirectories]); }
/** * Signals that the compile command was successfully finished. * * @param integer $classCount Number of compiled proxy classes * @return void * @Flow\Signal */ protected function emitFinishedCompilationRun($classCount) { $this->signalSlotDispatcher->dispatch(__CLASS__, 'finishedCompilationRun', [$classCount]); }