if (monitor == null) {
monitor = new NullProgressMonitor();
}
final IFacetedProject facetedProject = ProjectFacetsManager.create(project, true, monitor);
if (facetedProject == null) {
Logger.log(Logger.ERROR, "Unable to create faceted composer project.");
return null;
}
IProjectFacet coreFacet = ProjectFacetsManager.getProjectFacet(PHPFacetsConstants.PHP_CORE_COMPONENT);
IProjectFacet composerFacet = ProjectFacetsManager.getProjectFacet(ComposerFacetConstants.COMPOSER_COMPONENT);
// install the fixed facets
if (!facetedProject.hasProjectFacet(coreFacet)) {
facetedProject.installProjectFacet(coreFacet.getDefaultVersion(), null, monitor);
facetedProject.installProjectFacet(PHPFacets.convertToFacetVersion(version), null, monitor);
}
if (!facetedProject.hasProjectFacet(composerFacet)) {
facetedProject.installProjectFacet(composerFacet.getVersion(ComposerFacetConstants.COMPOSER_COMPONENT_VERSION_1), composerFacet, monitor);
}
return facetedProject;
} catch (CoreException ex) {