Common

# Class: Accounting Source Location: /common/Accounting.php
### Class Overview
Abstract base class for accounting management. #### Author(s): Sylvain Pasche <sylvain.pasche@camptocamp.com> | ### Variables $accountings $active $cacheHit $instance $pluginLoaded | ### Methods __construct account getConfig getInstance getKind getMapId isActive pluginLoaded reset save saveDb saveFile setActive setCacheHit
### Child classes: ClientAccountingImpl Client implementation of accounting management. ServerAccountingImpl Server implementation of accounting management. DummyAccounting Dummy accounting implementation used in case Cartoclient/server is not loaded
### Class Details [line 29] Abstract base class for accounting management. #### Tags:
abstract: |
author: | Sylvain Pasche <sylvain.pasche@camptocamp.com>
[ Top ] ### Class Variables #### $accountings = array() [line 35] Hash of accounting messages. Indexed by labels #### Tags:
access: | private
Type: | array
[ Top ] #### $active = true [line 60] True when accounting is active. Used to shut down accounting temporarily #### Tags:
access: | private
Type: | boolean
[ Top ] #### $cacheHit = false [line 54] True when a cache hit on server occured, to prevent error message of accounting plugin not loaeded #### Tags:
access: | private
Type: | boolean
[ Top ] #### $instance = [line 47] Singleton #### Tags:
static: |
access: | private
Type: | Accounting
[ Top ] #### $pluginLoaded = [line 41] Used to track if accounting plugin is loaded #### Tags:
access: | private
Type: | boolean
[ Top ] ### Class Methods ### constructor __construct [line 65]
`Accounting __construct( )`
Constructor. Can't be called directly, use getInstance() instead. #### Tags:
access: | protected
Overridden in child classes as: ClientAccountingImpl::__construct() Constructor ServerAccountingImpl::__construct() Constructor DummyAccounting::__construct() Constructor [ Top ] ### method account [line 101]
`void account( string $label, string $value)`
Records an accounting message #### Tags:
access: | public
#### Parameters:
string | $label | the label to identify the accounting information
string | $value | accounting data
[ Top ] ### method getConfig [line 142]
`Config getConfig( )`
Returns the client or server configuration object #### Tags:
access: | protected
abstract: |
Overridden in child classes as: ClientAccountingImpl::getConfig() ServerAccountingImpl::getConfig() DummyAccounting::getConfig() [ Top ] ### method getInstance [line 72]
`void getInstance( )`
Returns the instance of this class. #### Tags:
static: |
access: | public
[ Top ] ### method getKind [line 130]
`string getKind( )`
Returns type of Accoungint ('client' or 'server') #### Tags:
access: | protected
abstract: |
Overridden in child classes as: ClientAccountingImpl::getKind() ServerAccountingImpl::getKind() DummyAccounting::getKind() [ Top ] ### method getMapId [line 136]
`string getMapId( )`
Returns the mapId of the current map. #### Tags:
return: | mapId
access: | protected
abstract: |
Overridden in child classes as: ClientAccountingImpl::getMapId() ServerAccountingImpl::getMapId() DummyAccounting::getMapId() [ Top ] ### method isActive [line 258]
`boolean isActive( )`
Returns true if accounting is active and enabled #### Tags:
access: | public
[ Top ] ### method pluginLoaded [line 122]
`void pluginLoaded( )`
Needs to be called by accounting plugin, to detect case when the accounting plugin was not enabled and accouting is turned on. #### Tags:
access: | public
[ Top ] ### method reset [line 88]
`void reset( )`
Resets accounting messages #### Tags:
access: | public
[ Top ] ### method save [line 276]
`void save( )`
Saves all accounting messages to persistent storage. This should be called only once per request (client or server). #### Tags:
access: | public
[ Top ] ### method saveDb [line 178]
`void saveDb( accoutingPacket $accountingPacket, [mixed $isSimple = true])`
Saves an accounting packet (merge of all accounting messages) to database storage #### Tags:
access: | private
#### Parameters:
accoutingPacket | $accountingPacket | string
[ Top ] ### method saveFile [line 149]
`void saveFile( accoutingPacket $accountingPacket)`
Saves an accounting packet (merge of all accounting messages) to file storage #### Tags:
access: | private
#### Parameters:
accoutingPacket | $accountingPacket | string
[ Top ] ### method setActive [line 249]
`void setActive( active $active)`
Sets whether accounting is active or not. Can be used to disable accounting temporarily #### Tags:
access: | public
#### Parameters:
active | $active | boolean
[ Top ] ### method setCacheHit [line 267]
`void setCacheHit( )`
Tells accounting that a cache hit occured. This is used to prevent false error message in some situations. #### Tags:
access: | public
[ Top ] Documentation generated on Fri, 21 Sep 2007 13:30:28 +0200 by phpDocumentor 1.3.0RC3