/**
  * Handles a POST request that want to change the node name
  */
 public function changeNodeNameAction()
 {
     $nodeName = $this->bodyParam('node_name');
     if (!is_string($nodeName) || strlen($nodeName) < 3) {
         return new ApiProblemResponse(new ApiProblem(422, $this->translator->translate('The node name must be at least 3 characters long')));
     }
     $this->commandBus->dispatch(ChangeNodeName::to(NodeName::fromString($nodeName), ConfigLocation::fromPath(Definition::getSystemConfigDir())));
     return ['success' => true];
 }
 /**
  * @param ChangeNodeName $command
  */
 public function handle(ChangeNodeName $command)
 {
     $processingConfig = ProcessingConfig::initializeFromConfigLocation($command->configLocation());
     $processingConfig->changeNodeName($command->newNodeName(), $this->configWriter);
     $this->publishChangesOf($processingConfig);
 }