Autodoc
  • Namespace
  • Class
  • Tree

Namespaces

  • BlueTihi
    • Context
  • Brickrouge
    • Element
      • Nodes
    • Renderer
    • Widget
  • ICanBoogie
    • ActiveRecord
    • AutoConfig
    • CLDR
    • Composer
    • Core
    • Event
    • Exception
    • HTTP
      • Dispatcher
      • Request
    • I18n
      • Translator
    • Mailer
    • Modules
      • Taxonomy
        • Support
      • Thumbnailer
        • Versions
    • Object
    • Operation
      • Dispatcher
    • Prototype
    • Routes
    • Routing
      • Dispatcher
    • Session
  • Icybee
    • ActiveRecord
      • Model
    • ConfigOperation
    • Document
    • EditBlock
    • Element
      • ActionbarContextual
      • ActionbarSearch
      • ActionbarToolbar
    • FormBlock
    • Installer
    • ManageBlock
    • Modules
      • Articles
      • Cache
        • Collection
        • ManageBlock
      • Comments
        • ManageBlock
      • Contents
        • ManageBlock
      • Dashboard
      • Editor
        • Collection
      • Files
        • File
        • ManageBlock
      • Forms
        • Form
        • ManageBlock
      • I18n
      • Images
        • ManageBlock
      • Members
      • Modules
        • ManageBlock
      • Nodes
        • ManageBlock
        • Module
      • Pages
        • BreadcrumbElement
        • LanguagesElement
        • ManageBlock
        • NavigationBranchElement
        • NavigationElement
        • Page
        • PageController
      • Registry
      • Search
      • Seo
      • Sites
        • ManageBlock
      • Taxonomy
        • Terms
          • ManageBlock
        • Vocabulary
          • ManageBlock
      • Users
        • ManageBlock
        • NonceLogin
        • Roles
      • Views
        • ActiveRecordProvider
        • Collection
        • View
    • Operation
      • ActiveRecord
      • Constructor
      • Module
      • Widget
    • Rendering
  • None
  • Patron
  • PHP

Classes

  • CacheControlHeader
  • CallableDispatcher
  • ContentDispositionHeader
  • ContentTypeHeader
  • DateHeader
  • Dispatcher
  • File
  • FileList
  • Header
  • HeaderParameter
  • Headers
  • Helpers
  • RedirectResponse
  • Request
  • Response
  • WeightedDispatcher

Interfaces

  • IDispatcher

Exceptions

  • ForceRedirect
  • HTTPError
  • MethodNotSupported
  • NotFound
  • ServiceUnavailable
  • StatusCodeNotValid

Functions

  • dispatch
  • get_dispatcher
  • get_initial_request
 1 <?php
 2 
 3 /*
 4  * This file is part of the ICanBoogie package.
 5  *
 6  * (c) Olivier Laviale <olivier.laviale@gmail.com>
 7  *
 8  * For the full copyright and license information, please view the LICENSE
 9  * file that was distributed with this source code.
10  */
11 
12 namespace ICanBoogie\HTTP;
13 
14 use ICanBoogie\PropertyNotDefined;
15 
16 /**
17  * Base class for HTTP exceptions.
18  */
19 class HTTPError extends \Exception
20 {
21 
22 }
23 
24 /**
25  * Exception thrown when a resource is not found.
26  */
27 class NotFound extends HTTPError
28 {
29     public function __construct($message='The requested URL was not found on this server.', $code=404, \Exception $previous=null)
30     {
31         parent::__construct($message, $code, $previous);
32     }
33 }
34 
35 /**
36  * Exception thrown when the server is currently unavailable (because it is overloaded or
37  * down for maintenance).
38  */
39 class ServiceUnavailable extends HTTPError
40 {
41     public function __construct($message="The server is currently unavailable (because it is overloaded or down for maintenance).", $code=503, \Exception $previous=null)
42     {
43         parent::__construct($message, $code, $previous);
44     }
45 }
46 
47 /**
48  * Exception thrown when the HTTP method is not supported.
49  */
50 class MethodNotSupported extends HTTPError
51 {
52     public function __construct($method, $code=500, \Exception $previous=null)
53     {
54         parent::__construct(\ICanboogie\format('Method not supported: %method', array('method' => $method)), $code, $previous);
55     }
56 }
57 
58 /**
59  * Exception thrown when the HTTP status code is not valid.
60  */
61 class StatusCodeNotValid extends \InvalidArgumentException
62 {
63     public function __construct($status_code, $code=500, \Exception $previous=null)
64     {
65         parent::__construct("Status code not valid: {$status_code}.", $code, $previous);
66     }
67 }
68 
69 /**
70  * Exception thrown to force the redirect of the response.
71  *
72  * @property-read string $location The location of the redirect.
73  */
74 class ForceRedirect extends HTTPError
75 {
76     private $location;
77 
78     public function __construct($location, $code=302, \Exception $previous=null)
79     {
80         $this->location = $location;
81 
82         parent::__construct("Location: $location", $code, $previous);
83     }
84 
85     public function __get($property)
86     {
87         if ($property == 'location')
88         {
89             return $this->location;
90         }
91 
92         throw new PropertyNotDefined(array($property, $this));
93     }
94 }
Autodoc API documentation generated by ApiGen 2.8.0