Controller/Action/Helper/ConnectionCheck.php

Show: inherited
Table of Contents

\Conjoon_Controller_Action_Helper_ConnectionCheck

Package: Conjoon\Controller\Conjoon\Controller\Action\Helper

This helper checks whether a connection can be established to a specific ip. This helper's intended usage is to be called in actions that may query other domains where a network access is required. To skip expensive request timeouts, this helper can proxy a check for a given ip and if it returns false, the action can be skipped and instead an error message or default data can be returned by the action.

The configuration should be done in the bootstrapper for the application, using "setConfig()".

NOTE: This helper was developed during my time in the Euro Youth Hostel, Munich. Network access was granted given a very weak WLAN, where connection aborts might occure randomly and frequently. This helper should not be used as a general proxy for checking if network access is available, instead, always implement your business layer in a way this helper wouldn't even be necessary, and proxy this helper afterwards to save yourself the time waiting until a request timeout occures.

Parent(s)
\Zend_Controller_Action_Helper_Abstract
Category
Conjoon  
Uses
\Zend_Controller_Action_Helper_Abstract  

Properties

Propertyprotectedstring  $_config= 'array()'
static

Default valuearray()Details
Type
string

Methods

methodpublicdirect( ) : boolean

Method overloading.

Returns
Type Description
boolean
methodpublicisConnectionAvailable( ) : boolean

Checks whether a connection is available. If this class has not been configured using "setConfig()", this method will always return true.

This method will also return true if the enabled config option for this class has been set to 0/false.

Returns
Type Description
boolean Whether or not it can be assumed that network connections to other resources can be established
methodpublicsetConfig( Array $config ) : void
static

Sets the configuration for this class. Should be called statically in the bootstrap so the helper is configured once for every time it is used.

Parameters
Name Type Description
$config Array

An array with the following config options: - ip - timeout - port - enabled

Throws
Exception Description
\Zend_Controller_Action_Exception if the class has already been configured
Documentation was generated by DocBlox 0.18.1.