diff --git a/modules/biobank/php/.endpoint.class.inc.swp b/modules/biobank/php/.endpoint.class.inc.swp deleted file mode 100644 index 7a0ec6af230..00000000000 Binary files a/modules/biobank/php/.endpoint.class.inc.swp and /dev/null differ diff --git a/modules/biobank/php/endpoint.class.inc b/modules/biobank/php/endpoint.class.inc index a0f9fd21056..cb45ad18787 100644 --- a/modules/biobank/php/endpoint.class.inc +++ b/modules/biobank/php/endpoint.class.inc @@ -99,11 +99,9 @@ abstract class Endpoint $pathparts = explode('/', $path); // Check if sub-handlers are supported - // TODO: This can later be replaced with a check for the subhandler interface - // implementation rather than just checking if the function exists. - if ($this instanceof SubHandlerInterface && count($pathparts) > 1) { + if ($this instanceof HasSubEndpoints && count($pathparts) > 1) { $subpath = $pathparts[1]; - $subhandler = $this->getSubHandler($subpath); + $subhandler = $this->getSubEndpoint($subpath); // Remove the handled part of the path and pass the remainder $remainingPath = implode('/', array_slice($pathparts, 1)); diff --git a/modules/biobank/php/hassubendpoints.class.inc b/modules/biobank/php/hassubendpoints.class.inc new file mode 100644 index 00000000000..25edee8a568 --- /dev/null +++ b/modules/biobank/php/hassubendpoints.class.inc @@ -0,0 +1,25 @@ + + * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public + * License + */ +interface HasSubEndpoints +{ + /** + * Returns a sub-endpoint for a given subpath + * + * @param string $subpath The subpath to check for a sub-endpoint. + * + * @return Endpoint The sub-endpoint for the subpath + */ + public function getSubEndpoint(string $subpath): Endpoint; +} diff --git a/modules/biobank/php/subhandler.class.inc b/modules/biobank/php/subhandler.class.inc deleted file mode 100644 index a8dd70f97f6..00000000000 --- a/modules/biobank/php/subhandler.class.inc +++ /dev/null @@ -1,25 +0,0 @@ - - * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public - * License - */ -interface SubHandlerInterface -{ - /** - * Returns a sub-handler for a given subpath, if any exists. - * - * @param string $subpath The subpath to check for a sub-handler. - * - * @return ?Endpoint The sub-handler for the subpath, or null if none. - */ - public function getSubHandler(string $subpath): Endpoint; -}