Overview

Namespaces

  • Alpha
    • Controller
      • Front
    • Exception
    • Model
      • Type
    • Task
    • Util
      • Backup
      • Cache
      • Code
        • Highlight
        • Metric
      • Config
      • Convertor
      • Email
      • Extension
      • Feed
      • File
      • Graph
      • Helper
      • Http
        • Filter
        • Session
      • Image
      • Logging
      • Search
      • Security
    • View
      • Renderer
        • Html
        • Json
      • Widget

Classes

  • FrontController
  • Overview
  • Namespace
  • Class
  • Tree

Class FrontController

The front controller designed to optionally handle all requests.

Namespace: Alpha\Controller\Front
Copyright: Copyright (c) 2016, John Collins (founder of Alpha Framework). All rights reserved. <pre> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the Alpha Framework nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. </pre>
License: The BSD License
Author: John Collins <dev@alphaframework.org>
Since: 1.0
Located at Controller/Front/FrontController.php
Methods summary
public
# __construct( )

The constructor method.

The constructor method.

Throws

Alpha\Exception\BadRequestException
Alpha\Exception\BadRequestException

Since

1.0
public
# setEncrypt( boolean $encryptedQuery )

Sets the encryption flag.

Sets the encryption flag.

Parameters

$encryptedQuery
bool $encryptedQuery

Since

1.0
public static string
# generateSecureURL( string $params )

Static method for generating an absolute, secure URL for a page controller.

Static method for generating an absolute, secure URL for a page controller.

Parameters

$params
string $params

Returns

string
string

Since

1.0
public static string
# encodeQuery( string $queryString )

Static method for encoding a query string.

Static method for encoding a query string.

Parameters

$queryString
string $queryString

Returns

string
string

Since

1.0
public static string
# decodeQueryParams( mixed $tk )

Static method to return the decoded GET paramters from an encrytpted tk value.

Static method to return the decoded GET paramters from an encrytpted tk value.

Returns

string
string

Since

1.0
public static array
# getDecodeQueryParams( mixed $tk )

Static method to return the decoded GET paramters from an encrytpted tk value as an array of key/value pairs.

Static method to return the decoded GET paramters from an encrytpted tk value as an array of key/value pairs.

Returns

array
array

Since

1.0
public string
# getPageController( )

Getter for the page controller.

Getter for the page controller.

Returns

string
string

Since

1.0
public
# registerFilter( Alpha\Util\Http\Filter\FilterInterface $filterObject )

Add the supplied filter object to the list of filters ran on each request to the front controller.

Add the supplied filter object to the list of filters ran on each request to the front controller.

Parameters

$filterObject
Alpha\Util\Http\Filter\FilterInterface $filterObject

Throws

Alpha\Exception\IllegalArguementException
Alpha\Exception\IllegalArguementException

Since

1.0
public array
# getFilters( )

Returns the array of filters currently attached to this FrontController.

Returns the array of filters currently attached to this FrontController.

Returns

array
array

Since

1.0
public Alpha\Controller\Front\FrontController
# addRoute( string $URI, callable $callback )

Add a new route to map a URI to the callback that will service its requests, normally by invoking a controller class.

Add a new route to map a URI to the callback that will service its requests, normally by invoking a controller class.

Parameters

$URI
string $URI The URL to match, can include params within curly {} braces.
$callback
callable $callback The method to service the matched requests (should return a Response!).

Returns

Alpha\Controller\Front\FrontController
Alpha\Controller\Front\FrontController

Throws

Alpha\Exception\IllegalArguementException
Alpha\Exception\IllegalArguementException

Since

2.0
public Alpha\Controller\Front\FrontController
# value( string $param, mixed $defaultValue )

Method to allow the setting of default request param values to be used when they are left off the request URI.

Method to allow the setting of default request param values to be used when they are left off the request URI.

Parameters

$param
string $param The param name (as defined on the route between {} braces)
$defaultValue
mixed $defaultValue The value to use

Returns

Alpha\Controller\Front\FrontController
Alpha\Controller\Front\FrontController

Since

2.0
public callable
# getRouteCallback( string $URI )

Get the defined callback in the routes array for the URI provided.

Get the defined callback in the routes array for the URI provided.

Parameters

$URI
string $URI The URI to search for.

Returns

callable
callable

Throws

Alpha\Exception\IllegalArguementException
Alpha\Exception\IllegalArguementException

Since

2.0
public Alpha\Util\Http\Response
# process( Alpha\Util\Http\Request $request )

Processes the supplied request by invoking the callable defined matching the request's URI.

Processes the supplied request by invoking the callable defined matching the request's URI.

Parameters

$request
Alpha\Util\Http\Request $request The request to process

Returns

Alpha\Util\Http\Response
Alpha\Util\Http\Response

Throws

Alpha\Exception\ResourceNotFoundException
Alpha\Exception\ResourceNotFoundException
Alpha\Exception\ResourceNotAllowedException
Alpha\Exception\ResourceNotAllowedException
Alpha\Exception\AlphaException
Alpha\Exception\AlphaException

Since

2.0
Alpha Framework 2.0.4 API Documentation API documentation generated by ApiGen 2.8.0