# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=9

COMPOSER_INSTALL_PATH="Laminas/Diactoros"
COMPOSER_PKG="${PN}"
PHP_REQ_USE="curl?,gd?,ipv6?,xml?"

inherit composer git-r3

DESCRIPTION="PSR HTTP Message implementations"
HOMEPAGE="https://github.com/laminas/laminas-diactoros"
EGIT_REPO_URI="https://github.com/laminas/laminas-diactoros.git"

LICENSE="BSD"
SLOT="0"
IUSE="curl gd ipv6 xml"
REQUIRED_USE="test? ( curl gd xml )"

RDEPEND="dev-php/psr-http-factory
	dev-php/psr-http-message"
BDEPEND="test? ( dev-php/http-interop-http-factory-tests
		dev-php/php-http-psr7-integration-tests )"

PATCHES=( "${FILESDIR}/${PN}"-3.8.0-src-Stream.patch )

composer_enable_tests phpunit

src_prepare() {
	composer_src_prepare

	edo mkdir -p vendor/http-interop/http-factory-tests
	edo ln -s ../../../../../../../../../../usr/share/php/Interop/Http/Factory/ \
		vendor/http-interop/http-factory-tests/test
	use ipv6 || eapply "${FILESDIR}/${PN}"-3.8.0-tests-no-ipv6.patch
}