aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2023-03-27 20:49:05 +0000
committerElmar Ludwig <elmar.ludwig@uni-osnabrueck.de>2023-03-27 20:49:05 +0000
commit974691ee8ec6568b17d1066b377cc173df875709 (patch)
treee778a8d5a3152af5c3857da901b0c3091714cc60
parente605e048d00c009b5511fef2635968786304fdb3 (diff)
use camcelCase instead of snake case, re #2030
Merge request studip/studip!1668
-rw-r--r--lib/classes/Request.class.php6
-rw-r--r--lib/classes/restapi/Router.php2
-rw-r--r--public/api.php2
-rw-r--r--public/assets.php2
-rw-r--r--public/dispatch.php2
-rw-r--r--public/install.php2
-rw-r--r--public/plugins.php2
-rw-r--r--public/web_migrate.php2
-rw-r--r--tests/unit/lib/classes/RequestTest.php6
9 files changed, 13 insertions, 13 deletions
diff --git a/lib/classes/Request.class.php b/lib/classes/Request.class.php
index 27ed629..efdd2d6 100644
--- a/lib/classes/Request.class.php
+++ b/lib/classes/Request.class.php
@@ -150,7 +150,7 @@ class Request implements ArrayAccess, IteratorAggregate
* Return the filename of the currently executing script.
* @return string
*/
- public static function script_name(): string
+ public static function scriptName(): string
{
return $_SERVER['SCRIPT_NAME'];
}
@@ -159,9 +159,9 @@ class Request implements ArrayAccess, IteratorAggregate
* Returns the complete path info including duplicated slashes.
* $_SERVER['PATH_INFO'] will remove them.
*/
- public static function path_info(): string
+ public static function pathInfo(): string
{
- $script_name = self::script_name();
+ $script_name = self::scriptName();
$script_name = preg_quote($script_name, '#');
$script_name = str_replace('/', '/+', $script_name);
diff --git a/lib/classes/restapi/Router.php b/lib/classes/restapi/Router.php
index 7650919..232e9fe 100644
--- a/lib/classes/restapi/Router.php
+++ b/lib/classes/restapi/Router.php
@@ -523,7 +523,7 @@ class Router
private function normalizeDispatchURI($uri)
{
- return $uri ?? \Request::path_info();
+ return $uri ?? \Request::pathInfo();
}
private function normalizeRequestMethod($method)
diff --git a/public/api.php b/public/api.php
index 1376ae4..762c140 100644
--- a/public/api.php
+++ b/public/api.php
@@ -45,7 +45,7 @@ namespace RESTAPI {
// Initialize RESTAPI plugins
\PluginEngine::getPlugins('RESTAPIPlugin');
- $uri = \Request::path_info();
+ $uri = \Request::pathInfo();
// Check version
if (defined('RESTAPI\\VERSION') && preg_match('~^/v(\d+)~i', $uri, $match)) {
diff --git a/public/assets.php b/public/assets.php
index 824f84c..a0baa6d 100644
--- a/public/assets.php
+++ b/public/assets.php
@@ -15,7 +15,7 @@
require_once '../lib/bootstrap.php';
// Obtain request information
-$uri = ltrim(Request::path_info(), '/');
+$uri = ltrim(Request::pathInfo(), '/');
list($type, $id) = explode('/', $uri, 2);
// Setup response
diff --git a/public/dispatch.php b/public/dispatch.php
index 3bd9291..68d0399 100644
--- a/public/dispatch.php
+++ b/public/dispatch.php
@@ -22,4 +22,4 @@ require '../lib/bootstrap.php';
URLHelper::setBaseUrl($GLOBALS['ABSOLUTE_URI_STUDIP']);
$dispatcher = app(\Trails_Dispatcher::class);
-$dispatcher->dispatch(Request::path_info());
+$dispatcher->dispatch(Request::pathInfo());
diff --git a/public/install.php b/public/install.php
index c10f928..52f4bf0 100644
--- a/public/install.php
+++ b/public/install.php
@@ -55,7 +55,7 @@ if (!function_exists('_')) {
$GLOBALS['template_factory'] = new Flexi_TemplateFactory('../templates/');
# get plugin class from request
-$dispatch_to = ltrim(Request::path_info(), '/');
+$dispatch_to = ltrim(Request::pathInfo(), '/');
$dispatcher = new Trails_Dispatcher( '../app', $_SERVER['SCRIPT_NAME'], 'admin/install');
$dispatcher->dispatch("admin/install/{$dispatch_to}");
diff --git a/public/plugins.php b/public/plugins.php
index 368113d..99373a0 100644
--- a/public/plugins.php
+++ b/public/plugins.php
@@ -27,7 +27,7 @@ try {
require_once 'lib/seminar_open.php';
// get plugin class from request
- $dispatch_to = Request::path_info();
+ $dispatch_to = Request::pathInfo();
list($plugin_class, $unconsumed) = PluginEngine::routeRequest($dispatch_to);
// handle legacy forum plugin URLs
diff --git a/public/web_migrate.php b/public/web_migrate.php
index 02eeb95..79fba05 100644
--- a/public/web_migrate.php
+++ b/public/web_migrate.php
@@ -34,7 +34,7 @@ $_language_path = init_i18n($_SESSION['_language']);
$GLOBALS['template_factory'] = new Flexi_TemplateFactory('../templates/');
# get plugin class from request
-$dispatch_to = Request::path_info() ?: '';
+$dispatch_to = Request::pathInfo() ?: '';
$dispatcher = app(\Trails_Dispatcher::class);
$dispatcher->trails_uri = $_SERVER['SCRIPT_NAME'];
diff --git a/tests/unit/lib/classes/RequestTest.php b/tests/unit/lib/classes/RequestTest.php
index 0035196..dd1adc9 100644
--- a/tests/unit/lib/classes/RequestTest.php
+++ b/tests/unit/lib/classes/RequestTest.php
@@ -112,20 +112,20 @@ class RequestTest extends \Codeception\Test\Unit
public function testScriptName(): void
{
$this->setScriptName('/index.php');
- $this->assertEquals('/index.php', Request::script_name());
+ $this->assertEquals('/index.php', Request::scriptName());
}
/**
* @depends testPath
* @depends testScriptName
- * @covers Request::path_info
+ * @covers Request::pathInfo
* @dataProvider PathProvider
*/
public function testPathInfo(string $request_uri, string $script_name, string $expected): void
{
$this->setScriptName($script_name);
$this->setRequestUri($request_uri);
- $this->assertEquals($expected, Request::path_info());
+ $this->assertEquals($expected, Request::pathInfo());
}
/**