Registry

The objective of the Registry is to create one single PHP Object in which everything related to the Framework is stored. The Methods in the Registry carry out the activities of creating a single instance of the Registry and then adding Objects and Values to it, accessible via a given key. The methods explained are purely the ones that are likely to be used by Developers (including ourselves) in our day to day programming.

singleton()

arguments:        none

purpose:        This creates an instance of the Registry

activity:        if the Registry has already been set up, use it, if not, create it

returns:        the created Registry as an object

register()

arguments:        a) string - the name of the Class and the Class file,

b) string - the name of the registered class as it will be called from the registry,

               c) string (optional) the name of the subdirectory from which the Class will be loaded

purpose:        register an existing Class object in the Registry.

activity:        checks there are no problems with the inputs and if not loads the file, instantiates it and                        adds the object that has been created to the registry, including its methods

returns:        void

resolve()

arguments:        a) string - a class name

purpose:        Build an instance of the given Class

activity:        This Method uses ReflectionClass to find out information about the Methods and the                                Parameters needed for the Class. In one senses this is doing old things in a new way. That                        is, an alternative to Register(). However the advantage of Register(), is that the Class object                        is essentially part of the Framework but using resolve(), it is not.

returns:        an instance of the newly available and useable Class

set()

arguments:        a) string - a key for the data

b) string/array etc. the data to be stored

purpose:        Adds the value to the Framework instance so that it can be called from anywhere

returns:        void

get()

arguments:        a) string - key for the data required

purpose:        Gets a value from the instance store

returns:        the data, a value or object

has()

arguments:        a) string - key for the data required

purpose:        If a key exists for this item in the store, return the value, otherwise return false

activity:        Where we have used this function, we also needed a quick way to get the current language                        if the key "lcd" was used.

returns:        the data as a value or object if it exists or false        

pluginHook()

arguments:        a) string - plugin name

               b) string - method name

               c) array - parameters

purpose:        To load and register a Plugin and then invoke a callable Method from with the Plugin using                        the parameters supplied

activity:        The pluginpath has to be set previously

returns:        The response or return from the Plugin->Method()

Created with the Personal Edition of HelpNDoc: Easily create CHM Help documents