class FrontController extends AbstractSingleton implements StaticCreatorInterface

Constants

STATUS_INTERNAL_ERROR

Status shortcut constant for internal error

This one is used by PHP Exceptions during process

STATUS_OK

Status shortcut constant for no error

STATUS_UNEXPECTED_RESULT

Status shortcut constant for no error but unexcpected ending or values

STATUS_REQUEST_ERROR

Status shortcut constant for request error (arguments, 404 .

..)

STATUS_TREATMENT_ERROR

Status shortcut constant for process error (not PHP error but process of data)

Properties

static $default_messages Default messages for result status as status=>info pairs

Methods

static FrontController
create(Request $request = null, Response $response = null, array $user_options = array())

Creation of a singleton instance

static bool
log(string $message, array $context = array(), int $level = Logger::INFO, string $logname = null)

Shrotcut for logging message

distribute()

Distributes the application actions

display($return = false)

Displays the request result

bool
callController(string $name = 'DefaultController')

No description

bool
callControllerMethod(string $method = 'index')

No description

void
getControllerUsage()

No description

void
parseUsageFilepath(string $file_path)

No description

setUserOptions(array $options = null)

No description

array
getUserOptions()

No description

setOption(string $name, mixed $value)

No description

mixed|null
getOption(string $name)

No description

array
getLoggerOptions()

No description

setStatus(int $flag)

No description

int|null
getStatus()

No description

setMessage(string $string)

No description

string|null
getMessage()

No description

addContent(string $name, mixed $value)

No description

mixed
getContent($name)

No description

setRequest(Request $request)

No description

Request
getRequest()

No description

setResponse(Response $response)

No description

Response
getResponse()

No description

setLogger(Logger $logger)

No description

Logger
getLogger()

No description

setController(AbstractController $controller)

No description

Details

at line 204
static FrontController create(Request $request = null, Response $response = null, array $user_options = array())

Creation of a singleton instance

Parameters

Request $request \Library\HttpFundamental\Request
Response $response \Library\HttpFundamental\Response
array $user_options

Return Value

FrontController

at line 218
static bool log(string $message, array $context = array(), int $level = Logger::INFO, string $logname = null)

Shrotcut for logging message

Parameters

string $message
array $context
int $level
string $logname

Return Value

bool The result of \Library\Logger::log()

at line 236
distribute()

Distributes the application actions

at line 256
display($return = false)

Displays the request result

Parameters

$return

at line 284
bool callController(string $name = 'DefaultController')

Parameters

string $name

Return Value

bool

Exceptions

NotFoundException if class $name or WebServices\Controller\$name does not exist

at line 309
bool callControllerMethod(string $method = 'index')

Parameters

string $method

Return Value

bool

Exceptions

NotFoundException if method $method does not exist in object $this->controller

at line 325
void getControllerUsage()

Return Value

void

Exceptions

NotFoundException if the $usage_filepath property is set in the controller but the file can't be found

at line 345
void parseUsageFilepath(string $file_path)

Parameters

string $file_path

Return Value

void

Exceptions

NotFoundException if the $usage_filepath property is set in the controller but the file can't be found

at line 397
FrontController setUserOptions(array $options = null)

Parameters

array $options

Return Value

FrontController

at line 406
array getUserOptions()

Return Value

array

at line 416
FrontController setOption(string $name, mixed $value)

Parameters

string $name
mixed $value

Return Value

FrontController

at line 426
mixed|null getOption(string $name)

Parameters

string $name

Return Value

mixed|null

at line 434
array getLoggerOptions()

Return Value

array

at line 454
FrontController setStatus(int $flag)

Parameters

int $flag Must be one of the class constants STATUS_...

Return Value

FrontController

at line 463
int|null getStatus()

Return Value

int|null

at line 472
FrontController setMessage(string $string)

Parameters

string $string

Return Value

FrontController

at line 481
string|null getMessage()

Return Value

string|null

at line 491
FrontController addContent(string $name, mixed $value)

Parameters

string $name
mixed $value

Return Value

FrontController

at line 500
mixed getContent($name)

Parameters

$name

Return Value

mixed

at line 509
FrontController setRequest(Request $request)

Parameters

Request $request

Return Value

FrontController

at line 518
Request getRequest()

Return Value

Request

at line 527
FrontController setResponse(Response $response)

Parameters

Response $response

Return Value

FrontController

at line 536
Response getResponse()

Return Value

Response

at line 545
FrontController setLogger(Logger $logger)

Parameters

Logger $logger

Return Value

FrontController

at line 554
Logger getLogger()

Return Value

Logger

at line 563
FrontController setController(AbstractController $controller)

Parameters

AbstractController $controller

Return Value

FrontController

at line 572
AbstractController getController()

Return Value

AbstractController