Class: dataControllerHTTPError

Attributes:
Inherits:
Implements:

Contents:

Introduction

A simple class which standardises what happens when a HTTP error is encountered.

Meta Data

authorBashkim Isai
packageCore

Constants

There are no constants defined for this class.

Properties

Methods

Also See

Class Syntax

In file D:\oblib-core\php\oblib\dataContent\dataController.controller.php between lines 221 and 260.

<?php
 
    
/**
     * A simple class which standardises what happens when a HTTP error is encountered.
     *
     * @author    Bashkim Isai
     * @package    Core
     * @see        Class [dataController]
     * @see        Class [dataSection]
     */

    
class dataControllerHTTPError extends dataController
    
{
        
        
/**
         * Contains a human readable representation of the error code being thrown
         *
         * @type    Array [Integer => String]
         */
        
        
static $arrResponse = Array (
            
400        => 'Bad Request',
            
401        => 'Unauthorized',
            
403        => 'Forbidden',
            
404        => 'Not Found',
            
500        => 'Internal Server Error',
        );
        
        
/**
         * Constructs the basics for the HTTP Error controller
         * 
         * @see        Class [data]
         * @see        Class [dataObject]
         * @return    Void
         */
        
        
function ___construct ($intError)
        {
            if (!isset (
self::$arrResponse [$intError]))
            {
                
$intError 500;
            }
            
            
$this->___Push (new dataString ('ErrorNumber'$intError));
            
$this->___Push (new dataString ('ErrorResponse'self::$arrResponse [$intError]));
            
            
header (sprintf ('HTTP/1.0 %1$d %2$s'$intErrorself::$arrResponse [$intError]));
            
$this->___Output (DIR_SYS '/xsl/error/http.xsl');
            exit;
        }
    }

?>