/** * Builds code which registers the lifecycle shutdown method, if any. * * @param Configuration $objectConfiguration * @return string */ protected function buildLifecycleShutdownCode(Configuration $objectConfiguration) { $lifecycleShutdownMethodName = $objectConfiguration->getLifecycleShutdownMethodName(); if (!$this->reflectionService->hasMethod($objectConfiguration->getClassName(), $lifecycleShutdownMethodName)) { return ''; } $className = $objectConfiguration->getClassName(); $code = "\n" . ' if (get_class($this) === \'' . $className . '\') {' . "\n"; $code .= ' \\TYPO3\\Flow\\Core\\Bootstrap::$staticObjectManager->registerShutdownObject($this, \'' . $lifecycleShutdownMethodName . '\');' . PHP_EOL; $code .= ' }' . "\n"; return $code; }