/** * Saves the source code of the given project. * * @param Project $project * @param array $entityChangeSet * * @return void */ protected function saveProjectData(Project $project, array $entityChangeSet) { if (($file = $project->getFile()) === null) { return; } $filepath = $project->getFilepath(); $file->move(dirname($filepath), basename($filepath)); $project->setFile(); // If the source code is different from the old one, dispatch an event which lets other // components know that. if (!empty($entityChangeSet['hash'])) { $event = new SourceChangeEvent($project, $this); $this->eventDispatcher->dispatch(ProjectEvents::SOURCE_CHANGE, $event); } }