/** * 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]); }
/** * @test */ public function unfreezePackageEmitsPackageStatesUpdatedSignal() { $this->mockApplicationContext->expects($this->atLeastOnce())->method('isDevelopment')->will($this->returnValue(true)); $this->packageManager->createPackage('Some.Package', ['name' => 'some/package', 'type' => 'neos-package']); $this->packageManager->freezePackage('Some.Package'); $this->mockDispatcher->expects($this->once())->method('dispatch')->with(PackageManager::class, 'packageStatesUpdated'); $this->packageManager->unfreezePackage('Some.Package'); }
/** * 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 * @expectedException \InvalidArgumentException */ public function connectWithSignalNameStartingWithEmitShouldNotBeAllowed() { $mockSignal = $this->getMockBuilder('stdClass')->setMethods(['emitSomeSignal'])->getMock(); $mockSlot = $this->getMockBuilder('stdClass')->setMethods(['someSlotMethod'])->getMock(); $dispatcher = new Dispatcher(); $dispatcher->connect(get_class($mockSignal), 'emitSomeSignal', get_class($mockSlot), 'someSlotMethod', false); }
/** * 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]); }