resource->destination->server; if (!$server->isFunctional()) { return 'Server is not functional'; } switch ($this->resource->type()) { case 'application': StopApplication::run($this->resource); break; case 'standalone-postgresql': StopDatabase::run($this->resource); break; case 'standalone-redis': StopDatabase::run($this->resource); break; case 'standalone-mongodb': StopDatabase::run($this->resource); break; case 'service': StopService::run($this->resource); break; } } catch (\Throwable $e) { send_internal_notification('ContainerStoppingJob failed with: ' . $e->getMessage()); throw $e; } finally { $this->resource->delete(); } } }