private function tryToValidateWithComposerFile(Bundle $bundle, Contents $contentApi)
{
$validComposer = false;
try {
$file = $contentApi->show($bundle->getOwnerName(), $bundle->getName(), 'composer.json');
$composer = $this->decodeFileContent($file, true);
if (JSON_ERROR_NONE === json_last_error()) {
if (isset($composer['type']) && false !== strpos(strtolower($composer['type']), 'symfony')) {
$validComposer = true;
}
if (isset($composer['autoload']['psr-0'])) {
foreach ($composer['autoload']['psr-0'] as $key => $value) {
if (preg_match('/\\\\(.*)(\\w*)Bundle$/', $key) > 0) {
$validComposer = true;
}
}
}
if (isset($composer['autoload']['psr-4'])) {
foreach ($composer['autoload']['psr-4'] as $key => $value) {
if (preg_match('/\\\\(.*)(\\w*)Bundle$/', $key) > 0) {
$validComposer = true;
}
}
}
}
} catch (RuntimeException $e) {
$validComposer = false;
}
return $validComposer;
}