36 'CONTENT_LENGTH' => 1,
39 'PHP_AUTH_DIGEST' => 1,
54 $environment = self::determineAuthorization($environment);
55 foreach ($environment as
$key => $value) {
57 if (isset(static::$special[
$key]) || strpos($key,
'HTTP_') === 0) {
58 if ($key !==
'HTTP_CONTENT_LENGTH') {
64 return new static(
$data);
78 $authorization = $environment->
get(
'HTTP_AUTHORIZATION');
80 if (empty($authorization) && is_callable(
'getallheaders')) {
81 $headers = getallheaders();
82 $headers = array_change_key_case($headers, CASE_LOWER);
83 if (isset($headers[
'authorization'])) {
84 $environment->
set(
'HTTP_AUTHORIZATION', $headers[
'authorization']);
100 $all = parent::all();
102 foreach ($all as
$key => $props) {
103 $out[$props[
'originalKey']] = $props[
'value'];
118 public function set(
$key, $value)
120 if (!is_array($value)) {
125 'originalKey' =>
$key 137 public function get(
$key, $default = null)
175 $oldValues = $this->
get(
$key, []);
176 $newValues = is_array($value) ? $value : [$value];
177 $this->
set(
$key, array_merge($oldValues, array_values($newValues)));
215 $key = strtr(strtolower(
$key),
'_',
'-');
216 if (strpos(
$key,
'http-') === 0) {
set($key, $value)
Set collection item.
get($key, $default=null)
Get collection item for key.
Slim Framework (https://slimframework.com)