From d42b68c560bf561298547bc1079b3141c87f148a Mon Sep 17 00:00:00 2001 From: Max Schmidt Date: Mon, 9 Sep 2019 18:47:17 +0200 Subject: [PATCH] TASK: Add hidden configuration 'allow_ssl_downgrade' --- src/Json/Repository.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Json/Repository.php b/src/Json/Repository.php index 9f9fa8d..5d392f2 100644 --- a/src/Json/Repository.php +++ b/src/Json/Repository.php @@ -29,6 +29,11 @@ class Repository extends AbstractClass */ protected $options; + /** + * @var bool + */ + protected $allowSslDowngrade; + /** * @var ComposerJson|null */ @@ -44,6 +49,7 @@ public function __construct(array $data = []) $this->type = (array_key_exists('type', $data) ? $data['type'] : ''); $this->url = (array_key_exists('url', $data) ? $data['url'] : ''); $this->options = (array_key_exists('options', $data) ? $data['options'] : []); + $this->allowSslDowngrade = (array_key_exists('allow_ssl_downgrade', $data) ? $data['allow_ssl_downgrade'] : false); $this->package = (array_key_exists('package', $data) ? new ComposerJson($data['package']) : null); } @@ -75,6 +81,16 @@ public function getOptions() : array return $this->options; } + /** + * Get if ssl may be downgraded for this repository. + * @see https://github.com/composer/composer/blob/0fe200d6d950b0774688713be3153bb410eb70b8/src/Composer/Repository/ComposerRepository.php#L87-L89 + * @return bool + */ + public function isSslDowngradeAllowed() : bool + { + return $this->allowSslDowngrade; + } + /** * Gets the parsed "package" key of the repository. * @return ComposerJson|null