/**
  * Generates the mock file's namespace
  *
  * If a mockFileBaseNamespace is not defined, this will use composer
  * to try to find a valid one. Failing that, a wild-assed-guess is returned.
  *
  * @param   string     $mockSavePath    Fully qualified file save path of file to be mocked
  * @param   ConfigData $config          ConfigData object
  *                                      Required data points are:
  *                                      - getMockFileBaseNamespace()
  *                                      - getProjectRootPath()
  *                                      - getMockWriteDir()
  * @return  string
  */
 private function generateMockFileNamespace($mockSavePath, ConfigData $config)
 {
     $wagNamespace = PathWorker::convertFilePathToClassPath($mockSavePath, $config->getProjectRootPath());
     if ($config->getMockFileBaseNamespace()) {
         return $this->determineWithBaseNamespace($mockSavePath, $config->getMockFileBaseNamespace());
     }
     $composerWorker = new ComposerWorker();
     $composerData = $composerWorker->getNamespaceFromComposer($mockSavePath, $config->getProjectRootPath());
     if (!$composerData) {
         return $wagNamespace;
     }
     $relNamespacePath = str_replace($composerData['path'], '', $mockSavePath);
     $namespace = $composerData['namespace'] . str_replace('/', '\\', $relNamespacePath);
     return rtrim($namespace, '\\');
 }