Controller/Action/Helper/ConnectionCheck.php
\Conjoon_Controller_Action_Helper_ConnectionCheck
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
Methods

isConnectionAvailable(
)
:
booleanChecks 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.
| Type | Description |
|---|---|
| boolean | Whether or not it can be assumed that network connections to other resources can be established |

setConfig(
Array $config
)
:
voidSets the configuration for this class. Should be called statically in the bootstrap so the helper is configured once for every time it is used.
| Name | Type | Description |
|---|---|---|
| $config | Array | An array with the following config options: - ip - timeout - port - enabled |
| Exception | Description |
|---|---|
| \Zend_Controller_Action_Exception | if the class has already been configured |