LFT
  • Namespace
  • Class
  • Tree

Namespaces

  • Docoflow
    • Contracts
    • Entity
    • Facades
    • Models
    • Traits
  • Docolight
    • Agno
      • Traits
    • Container
    • Http
      • Contracts
    • Rest
      • Handler
      • Http
    • Support
      • Debug
      • Traits
  • Docotory
    • Traits
  • None

Classes

  • Docoflow\Docoflow
  • Docoflow\Entity\Group
  • Docoflow\Entity\Step
  • Docoflow\Entity\Verificator
  • Docoflow\Facades\Action
  • Docoflow\Facades\Activity
  • Docoflow\Facades\Flo
  • Docoflow\Facades\StateActivity
  • Docoflow\Flo
  • Docoflow\Models\Workflow
  • Docoflow\Models\WorkflowAction
  • Docoflow\Models\WorkflowActivity
  • Docoflow\Models\WorkflowGroups
  • Docoflow\Models\WorkflowNotification
  • Docoflow\Models\WorkflowState
  • Docoflow\Models\WorkflowStateActivity
  • Docoflow\Models\WorkflowStep
  • Docoflow\Models\WorkflowVerificator
  • Docolight
  • Docolight\Agno\AgnoModule
  • Docolight\Container\Container
  • Docolight\Http\Headers
  • Docolight\Http\JsonResponse
  • Docolight\Http\MimeResponse
  • Docolight\Http\Response
  • Docolight\Http\ResponseFactory
  • Docolight\Rest\Handler\RestfulErrorHandler
  • Docolight\Rest\Http\RestFulController
  • Docolight\Support\ActiveRecordWrapper
  • Docolight\Support\Arr
  • Docolight\Support\Carbonate
  • Docolight\Support\ClassLoader
  • Docolight\Support\Collection
  • Docolight\Support\CollectionDataProvider
  • Docolight\Support\Debug\Dumper
  • Docolight\Support\Debug\HtmlDumper
  • Docolight\Support\Facade
  • Docolight\Support\Factory
  • Docolight\Support\Fluent
  • Docolight\Support\Html
  • Docolight\Support\IterablePager
  • Docolight\Support\Repository
  • Docolight\Support\Set
  • Docolight\Support\Str
  • Docotory\Factory

Interfaces

  • Docoflow\Contracts\DocoflowContract
  • Docoflow\Contracts\ValidationStatus
  • Docolight\Http\Contracts\Arrayable

Traits

  • Docoflow\Traits\BulkValidator
  • Docoflow\Traits\Entity
  • Docoflow\Traits\HasMutator
  • Docoflow\Traits\Validable
  • Docolight\Agno\Traits\HasAssetsUrl
  • Docolight\Agno\Traits\HasAutoload
  • Docolight\Support\Traits\Macroable
  • Docotory\Traits\HasFactories

Exceptions

  • Docolight\Container\BindingResolutionException
  • Docotory\ResolvingTypeException

Functions

  • array_add
  • array_build
  • array_collapse
  • array_divide
  • array_dot
  • array_except
  • array_first
  • array_flatten
  • array_forget
  • array_get
  • array_has
  • array_last
  • array_only
  • array_pluck
  • array_pull
  • array_replace_value
  • array_set
  • array_sort
  • array_sort_recursive
  • array_where
  • cache
  • camel_case
  • class_basename
  • class_uses_recursive
  • collect
  • container
  • data_get
  • dd
  • def
  • dump
  • e
  • ends_with
  • fluent
  • get
  • head
  • input
  • last
  • object_get
  • preg_replace_sub
  • request
  • response
  • session
  • snake_case
  • starts_with
  • str_contains
  • str_finish
  • str_is
  • str_limit
  • str_random
  • str_replace_array
  • str_slug
  • studly_case
  • title_case
  • trait_uses_recursive
  • transaction
  • trimtolower
  • value
  • with
 1 <?php
 2 
 3 namespace Docolight\Http;
 4 
 5 use Docolight\Support\Set;
 6 
 7 /**
 8  * HTTP Headers.
 9  *
10  * ```php
11  * $headers = new Docolight\Http\Headers;
12  *
13  * $headers->set('My-Header-Index', 'My header value');
14  * ```
15  *
16  * @author Krisan Alfa Timur <krisanalfa@docotel.co.id>
17  */
18 class Headers extends Set
19 {
20     /**
21      * Special-case HTTP headers that are otherwise unidentifiable as HTTP headers.
22      * Typically, HTTP headers in the $_SERVER array will be prefixed with
23      * `HTTP_` or `X_`. These are not so we list them here for later reference.
24      *
25      * @var array
26      */
27     protected static $special = array(
28         'CONTENT_TYPE',
29         'CONTENT_LENGTH',
30         'PHP_AUTH_USER',
31         'PHP_AUTH_PW',
32         'PHP_AUTH_DIGEST',
33         'AUTH_TYPE',
34     );
35 
36     /**
37      * Extract HTTP headers from an array of data (e.g. $_SERVER).
38      *
39      * @param array $data
40      *
41      * @return array
42      */
43     public static function extract($data)
44     {
45         $results = array();
46 
47         foreach ($data as $key => $value) {
48             $key = strtoupper($key);
49 
50             if (strpos($key, 'X_') === 0 or strpos($key, 'HTTP_') === 0 or in_array($key, static::$special)) {
51                 if ($key !== 'HTTP_CONTENT_LENGTH') {
52                     $results[$key] = $value;
53                 }
54             }
55         }
56 
57         return $results;
58     }
59 
60     /**
61      * Transform header name into canonical form.
62      *
63      * @param string $key
64      *
65      * @return string
66      */
67     protected function normalizeKey($key)
68     {
69         $key = strtolower($key);
70         $key = str_replace(array('-', '_'), ' ', $key);
71         $key = preg_replace('#^http #', '', $key);
72         $key = ucwords($key);
73         $key = str_replace(' ', '-', $key);
74 
75         return $key;
76     }
77 }
78 
LFT API documentation generated by ApiGen