Select Git revision
UserManagement.class.php
Forked from
Stud.IP / Stud.IP
Source project has a limited visibility.
-
Moritz Strohm authored
Merge request studip/studip!562
Moritz Strohm authoredMerge request studip/studip!562
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
Request.class.php 23.27 KiB
<?php
# Lifter007: TODO
/*
* Request.php - class representing a HTTP request in Stud.IP
*
* Copyright (c) 2009 Elmar Ludwig
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*/
/**
* Singleton class representing a HTTP request in Stud.IP.
*/
class Request implements ArrayAccess, IteratorAggregate
{
/**
* cached request parameter array
*/
private $params;
/**
* Initialize a new Request instance.
*/
private function __construct()
{
$this->params = array_merge($_GET, $_POST);
}
/**
* Return the Request singleton instance.
*/
public static function getInstance()
{
static $instance;
if (isset($instance)) {
return $instance;
}
return $instance = new Request();
}
/**
* ArrayAccess: Check whether the given offset exists.
*
* @todo Add bool return type when Stud.IP requires PHP8 minimal
*/
#[ReturnTypeWillChange]
public function offsetExists($offset)
{
return isset($this->params[$offset]);
}
/**
* ArrayAccess: Get the value at the given offset.
*
* @todo Add mixed return type when Stud.IP requires PHP8 minimal
*/
#[ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->params[$offset] ?? null;
}
/**
* ArrayAccess: Set the value at the given offset.
*