protected function getPrimaryNamespaceAndEntryPath(PackageInterface $package) { $autoloadConfigurations = $package->getComposerManifest('autoload'); $firstAutoloadType = null; $firstAutoloadConfiguration = null; foreach ($autoloadConfigurations as $autoloadType => $autoloadConfiguration) { if (ClassLoader::isAutoloadTypeWithPredictableClassPath($autoloadType)) { $firstAutoloadType = $autoloadType; $firstAutoloadConfiguration = $autoloadConfiguration; break; } } $autoloadPaths = reset($firstAutoloadConfiguration); $firstAutoloadPath = is_array($autoloadPaths) ? reset($autoloadPaths) : $autoloadPaths; $namespace = key($firstAutoloadConfiguration); $autoloadPathPostfix = ''; if ($firstAutoloadType === ClassLoader::MAPPING_TYPE_PSR0) { $autoloadPathPostfix = str_replace('\\', '/', trim($namespace, '\\')); } return [$namespace, Files::concatenatePaths([$package->getPackagePath(), $firstAutoloadPath, $autoloadPathPostfix]), $firstAutoloadType]; }