public function updateFiles(Bundle $bundle, array $onlyFiles = null) { $this->output->write(' files'); /** @var \Github\Api\Repository\Contents $api */ $api = $this->github->api('repo')->contents(); try { $files = $api->show($bundle->getOwnerName(), $bundle->getName()); } catch (RuntimeException $e) { return false; } foreach ($files as $data) { switch ($data['name']) { case 'LICENSE': if (null !== $onlyFiles && !in_array('license', $onlyFiles)) { continue; } try { $file = $api->show($bundle->getOwnerName(), $bundle->getName(), 'LICENSE'); $bundle->setLicense(base64_decode($file['content'])); } catch (RuntimeException $e) { } break; case '.travis.yml': if (null !== $onlyFiles && !in_array('travis', $onlyFiles)) { continue; } $bundle->setUsesTravisCi(true); break; case 'composer.json': if (null !== $onlyFiles && !in_array('composer', $onlyFiles)) { continue; } try { $file = $api->show($bundle->getOwnerName(), $bundle->getName(), 'composer.json'); $this->updateComposerFile(base64_decode($file['content']), $bundle); } catch (RuntimeException $e) { } break; } } if (null === $onlyFiles || in_array('readme', $onlyFiles)) { try { $readme = $api->readme($bundle->getOwnerName(), $bundle->getName()); if (!isset($readme['message']) && 'base64' == $readme['encoding']) { $bundle->setReadme(base64_decode($readme['content'])); } } catch (RuntimeException $e) { } } if (null === $bundle->getLicense() && (null === $onlyFiles || in_array('license', $onlyFiles))) { try { $file = $api->show($bundle->getOwnerName(), $bundle->getName(), 'Resources/meta/LICENSE'); $bundle->setLicense(base64_decode($file['content'])); } catch (RuntimeException $e) { } } if (null === $onlyFiles || in_array('configuration', $onlyFiles)) { try { $this->updateCanonicalConfigFile($bundle); } catch (RuntimeException $e) { } } try { $this->updateVersionsHistory($bundle); } catch (RuntimeException $e) { } return true; }