From eb80d22222ba196bb6ed923f18ed5f117b502800 Mon Sep 17 00:00:00 2001
From: Tim van Dijen <tvdijen@gmail.com>
Date: Tue, 8 Mar 2022 21:26:55 +0100
Subject: [PATCH] Remove unused method

---
 lib/SimpleSAML/Utils/HTTP.php           | 17 -----------------
 modules/admin/lib/Controller/Config.php |  1 -
 tests/lib/SimpleSAML/Utils/HTTPTest.php | 14 --------------
 3 files changed, 32 deletions(-)

diff --git a/lib/SimpleSAML/Utils/HTTP.php b/lib/SimpleSAML/Utils/HTTP.php
index d43c45a5f..402901b67 100644
--- a/lib/SimpleSAML/Utils/HTTP.php
+++ b/lib/SimpleSAML/Utils/HTTP.php
@@ -675,23 +675,6 @@ class HTTP
     }
 
 
-    /**
-     * Retrieve the first element of the URL path.
-     *
-     * @param boolean $leadingSlash Whether to add a leading slash to the element or not. Defaults to true.
-     *
-     * @return string The first element of the URL path, with an optional, leading slash.
-     *
-     */
-    public function getFirstPathElement(bool $leadingSlash = true): string
-    {
-        if (preg_match('|^/(.*?)/|', $_SERVER['SCRIPT_NAME'], $matches)) {
-            return ($leadingSlash ? '/' : '') . $matches[1];
-        }
-        return '';
-    }
-
-
     /**
      * Create a link which will POST data.
      *
diff --git a/modules/admin/lib/Controller/Config.php b/modules/admin/lib/Controller/Config.php
index 42d0b580e..4d582c19b 100644
--- a/modules/admin/lib/Controller/Config.php
+++ b/modules/admin/lib/Controller/Config.php
@@ -96,7 +96,6 @@ class Config
                 'getSelfURLHost()' => [$this->httpUtils->getSelfURLHost()],
                 'getSelfURLNoQuery()' => [$this->httpUtils->getSelfURLNoQuery()],
                 'getSelfHostWithPath()' => [$this->httpUtils->getSelfHostWithPath()],
-                'getFirstPathElement()' => [$this->httpUtils->getFirstPathElement()],
                 'getSelfURL()' => [$this->httpUtils->getSelfURL()],
             ],
         ];
diff --git a/tests/lib/SimpleSAML/Utils/HTTPTest.php b/tests/lib/SimpleSAML/Utils/HTTPTest.php
index 907b0179c..855cc91bb 100644
--- a/tests/lib/SimpleSAML/Utils/HTTPTest.php
+++ b/tests/lib/SimpleSAML/Utils/HTTPTest.php
@@ -443,20 +443,6 @@ class HTTPTest extends ClearStateTestCase
     }
 
 
-    /**
-     */
-    public function testGetFirstPathElement(): void
-    {
-        $original = $_SERVER;
-        $httpUtils = new Utils\HTTP();
-
-        $_SERVER['SCRIPT_NAME'] = '/test/tmp.php';
-        $this->assertEquals($httpUtils->getFirstPathElement(), '/test');
-        $this->assertEquals($httpUtils->getFirstPathElement(false), 'test');
-        $_SERVER = $original;
-    }
-
-
     /**
      * @runInSeparateProcess
      * @requires extension xdebug
-- 
GitLab